
obj/user/lsfd.debug:     file format elf32-i386


Disassembly of section .text:

00800020 <_start>:
// starts us running when we are initially loaded into a new environment.
.text
.globl _start
_start:
	// See if we were started with arguments on the stack
	cmpl $USTACKTOP, %esp
  800020:	81 fc 00 e0 bf ee    	cmp    $0xeebfe000,%esp
	jne args_exist
  800026:	75 04                	jne    80002c <args_exist>

	// If not, push dummy argc/argv arguments.
	// This happens when we are loaded by the kernel,
	// because the kernel does not know about passing arguments.
	pushl $0
  800028:	6a 00                	push   $0x0
	pushl $0
  80002a:	6a 00                	push   $0x0

0080002c <args_exist>:

args_exist:
	call libmain
  80002c:	e8 e8 00 00 00       	call   800119 <libmain>
1:	jmp 1b
  800031:	eb fe                	jmp    800031 <args_exist+0x5>

00800033 <usage>:
#include <inc/lib.h>

void
usage(void)
{
  800033:	f3 0f 1e fb          	endbr32 
  800037:	55                   	push   %ebp
  800038:	89 e5                	mov    %esp,%ebp
  80003a:	83 ec 14             	sub    $0x14,%esp
	cprintf("usage: lsfd [-1]\n");
  80003d:	68 20 22 80 00       	push   $0x802220
  800042:	e8 e1 01 00 00       	call   800228 <cprintf>
	exit();
  800047:	e8 21 01 00 00       	call   80016d <exit>
}
  80004c:	83 c4 10             	add    $0x10,%esp
  80004f:	c9                   	leave  
  800050:	c3                   	ret    

00800051 <umain>:

void
umain(int argc, char **argv)
{
  800051:	f3 0f 1e fb          	endbr32 
  800055:	55                   	push   %ebp
  800056:	89 e5                	mov    %esp,%ebp
  800058:	57                   	push   %edi
  800059:	56                   	push   %esi
  80005a:	53                   	push   %ebx
  80005b:	81 ec b0 00 00 00    	sub    $0xb0,%esp
	int i, usefprint = 0;
	struct Stat st;
	struct Argstate args;

	argstart(&argc, argv, &args);
  800061:	8d 85 4c ff ff ff    	lea    -0xb4(%ebp),%eax
  800067:	50                   	push   %eax
  800068:	ff 75 0c             	pushl  0xc(%ebp)
  80006b:	8d 45 08             	lea    0x8(%ebp),%eax
  80006e:	50                   	push   %eax
  80006f:	e8 e0 0d 00 00       	call   800e54 <argstart>
	while ((i = argnext(&args)) >= 0)
  800074:	83 c4 10             	add    $0x10,%esp
	int i, usefprint = 0;
  800077:	be 00 00 00 00       	mov    $0x0,%esi
	while ((i = argnext(&args)) >= 0)
  80007c:	8d 9d 4c ff ff ff    	lea    -0xb4(%ebp),%ebx
		if (i == '1')
			usefprint = 1;
  800082:	bf 01 00 00 00       	mov    $0x1,%edi
	while ((i = argnext(&args)) >= 0)
  800087:	83 ec 0c             	sub    $0xc,%esp
  80008a:	53                   	push   %ebx
  80008b:	e8 f8 0d 00 00       	call   800e88 <argnext>
  800090:	83 c4 10             	add    $0x10,%esp
  800093:	85 c0                	test   %eax,%eax
  800095:	78 10                	js     8000a7 <umain+0x56>
		if (i == '1')
  800097:	83 f8 31             	cmp    $0x31,%eax
  80009a:	75 04                	jne    8000a0 <umain+0x4f>
			usefprint = 1;
  80009c:	89 fe                	mov    %edi,%esi
  80009e:	eb e7                	jmp    800087 <umain+0x36>
		else
			usage();
  8000a0:	e8 8e ff ff ff       	call   800033 <usage>
  8000a5:	eb e0                	jmp    800087 <umain+0x36>

	for (i = 0; i < 32; i++)
  8000a7:	bb 00 00 00 00       	mov    $0x0,%ebx
		if (fstat(i, &st) >= 0) {
  8000ac:	8d bd 5c ff ff ff    	lea    -0xa4(%ebp),%edi
  8000b2:	eb 26                	jmp    8000da <umain+0x89>
			if (usefprint)
				fprintf(1, "fd %d: name %s isdir %d size %d dev %s\n",
					i, st.st_name, st.st_isdir,
					st.st_size, st.st_dev->dev_name);
			else
				cprintf("fd %d: name %s isdir %d size %d dev %s\n",
  8000b4:	83 ec 08             	sub    $0x8,%esp
  8000b7:	8b 45 e4             	mov    -0x1c(%ebp),%eax
  8000ba:	ff 70 04             	pushl  0x4(%eax)
  8000bd:	ff 75 dc             	pushl  -0x24(%ebp)
  8000c0:	ff 75 e0             	pushl  -0x20(%ebp)
  8000c3:	57                   	push   %edi
  8000c4:	53                   	push   %ebx
  8000c5:	68 34 22 80 00       	push   $0x802234
  8000ca:	e8 59 01 00 00       	call   800228 <cprintf>
  8000cf:	83 c4 20             	add    $0x20,%esp
	for (i = 0; i < 32; i++)
  8000d2:	83 c3 01             	add    $0x1,%ebx
  8000d5:	83 fb 20             	cmp    $0x20,%ebx
  8000d8:	74 37                	je     800111 <umain+0xc0>
		if (fstat(i, &st) >= 0) {
  8000da:	83 ec 08             	sub    $0x8,%esp
  8000dd:	57                   	push   %edi
  8000de:	53                   	push   %ebx
  8000df:	e8 e3 13 00 00       	call   8014c7 <fstat>
  8000e4:	83 c4 10             	add    $0x10,%esp
  8000e7:	85 c0                	test   %eax,%eax
  8000e9:	78 e7                	js     8000d2 <umain+0x81>
			if (usefprint)
  8000eb:	85 f6                	test   %esi,%esi
  8000ed:	74 c5                	je     8000b4 <umain+0x63>
				fprintf(1, "fd %d: name %s isdir %d size %d dev %s\n",
  8000ef:	83 ec 04             	sub    $0x4,%esp
  8000f2:	8b 45 e4             	mov    -0x1c(%ebp),%eax
  8000f5:	ff 70 04             	pushl  0x4(%eax)
  8000f8:	ff 75 dc             	pushl  -0x24(%ebp)
  8000fb:	ff 75 e0             	pushl  -0x20(%ebp)
  8000fe:	57                   	push   %edi
  8000ff:	53                   	push   %ebx
  800100:	68 34 22 80 00       	push   $0x802234
  800105:	6a 01                	push   $0x1
  800107:	e8 e0 17 00 00       	call   8018ec <fprintf>
  80010c:	83 c4 20             	add    $0x20,%esp
  80010f:	eb c1                	jmp    8000d2 <umain+0x81>
					i, st.st_name, st.st_isdir,
					st.st_size, st.st_dev->dev_name);
		}
}
  800111:	8d 65 f4             	lea    -0xc(%ebp),%esp
  800114:	5b                   	pop    %ebx
  800115:	5e                   	pop    %esi
  800116:	5f                   	pop    %edi
  800117:	5d                   	pop    %ebp
  800118:	c3                   	ret    

00800119 <libmain>:
const volatile struct Env *thisenv;
const char *binaryname = "<unknown>";

void
libmain(int argc, char **argv)
{
  800119:	f3 0f 1e fb          	endbr32 
  80011d:	55                   	push   %ebp
  80011e:	89 e5                	mov    %esp,%ebp
  800120:	56                   	push   %esi
  800121:	53                   	push   %ebx
  800122:	8b 5d 08             	mov    0x8(%ebp),%ebx
  800125:	8b 75 0c             	mov    0xc(%ebp),%esi
	;    //系统调用，我们已经在Exercise 7中实现了
	
	
	
	//屏幕上打印出来了字母，但后续报错了，有意思，让我看看问题出现在哪。
	thisenv=0;
  800128:	c7 05 04 40 80 00 00 	movl   $0x0,0x804004
  80012f:	00 00 00 
	thisenv = &envs[ENVX(sys_getenvid())];      //获取Env结构指针
  800132:	e8 c6 0a 00 00       	call   800bfd <sys_getenvid>
  800137:	25 ff 03 00 00       	and    $0x3ff,%eax
  80013c:	6b c0 7c             	imul   $0x7c,%eax,%eax
  80013f:	05 00 00 c0 ee       	add    $0xeec00000,%eax
  800144:	a3 04 40 80 00       	mov    %eax,0x804004

	// save the name of the program so that panic() can use it
	if (argc > 0)
  800149:	85 db                	test   %ebx,%ebx
  80014b:	7e 07                	jle    800154 <libmain+0x3b>
		binaryname = argv[0];
  80014d:	8b 06                	mov    (%esi),%eax
  80014f:	a3 00 30 80 00       	mov    %eax,0x803000

	// call user main routine
	umain(argc, argv);
  800154:	83 ec 08             	sub    $0x8,%esp
  800157:	56                   	push   %esi
  800158:	53                   	push   %ebx
  800159:	e8 f3 fe ff ff       	call   800051 <umain>

	// exit gracefully
	exit();
  80015e:	e8 0a 00 00 00       	call   80016d <exit>
}
  800163:	83 c4 10             	add    $0x10,%esp
  800166:	8d 65 f8             	lea    -0x8(%ebp),%esp
  800169:	5b                   	pop    %ebx
  80016a:	5e                   	pop    %esi
  80016b:	5d                   	pop    %ebp
  80016c:	c3                   	ret    

0080016d <exit>:

#include <inc/lib.h>

void
exit(void)
{
  80016d:	f3 0f 1e fb          	endbr32 
  800171:	55                   	push   %ebp
  800172:	89 e5                	mov    %esp,%ebp
  800174:	83 ec 08             	sub    $0x8,%esp
	close_all();
  800177:	e8 26 10 00 00       	call   8011a2 <close_all>
	sys_env_destroy(0);
  80017c:	83 ec 0c             	sub    $0xc,%esp
  80017f:	6a 00                	push   $0x0
  800181:	e8 32 0a 00 00       	call   800bb8 <sys_env_destroy>
}
  800186:	83 c4 10             	add    $0x10,%esp
  800189:	c9                   	leave  
  80018a:	c3                   	ret    

0080018b <putch>:
};


static void
putch(int ch, struct printbuf *b)
{
  80018b:	f3 0f 1e fb          	endbr32 
  80018f:	55                   	push   %ebp
  800190:	89 e5                	mov    %esp,%ebp
  800192:	53                   	push   %ebx
  800193:	83 ec 04             	sub    $0x4,%esp
  800196:	8b 5d 0c             	mov    0xc(%ebp),%ebx
	b->buf[b->idx++] = ch;
  800199:	8b 13                	mov    (%ebx),%edx
  80019b:	8d 42 01             	lea    0x1(%edx),%eax
  80019e:	89 03                	mov    %eax,(%ebx)
  8001a0:	8b 4d 08             	mov    0x8(%ebp),%ecx
  8001a3:	88 4c 13 08          	mov    %cl,0x8(%ebx,%edx,1)
	if (b->idx == 256-1) {
  8001a7:	3d ff 00 00 00       	cmp    $0xff,%eax
  8001ac:	74 09                	je     8001b7 <putch+0x2c>
		sys_cputs(b->buf, b->idx);
		b->idx = 0;
	}
	b->cnt++;
  8001ae:	83 43 04 01          	addl   $0x1,0x4(%ebx)
}
  8001b2:	8b 5d fc             	mov    -0x4(%ebp),%ebx
  8001b5:	c9                   	leave  
  8001b6:	c3                   	ret    
		sys_cputs(b->buf, b->idx);
  8001b7:	83 ec 08             	sub    $0x8,%esp
  8001ba:	68 ff 00 00 00       	push   $0xff
  8001bf:	8d 43 08             	lea    0x8(%ebx),%eax
  8001c2:	50                   	push   %eax
  8001c3:	e8 ab 09 00 00       	call   800b73 <sys_cputs>
		b->idx = 0;
  8001c8:	c7 03 00 00 00 00    	movl   $0x0,(%ebx)
  8001ce:	83 c4 10             	add    $0x10,%esp
  8001d1:	eb db                	jmp    8001ae <putch+0x23>

008001d3 <vcprintf>:

int
vcprintf(const char *fmt, va_list ap)
{
  8001d3:	f3 0f 1e fb          	endbr32 
  8001d7:	55                   	push   %ebp
  8001d8:	89 e5                	mov    %esp,%ebp
  8001da:	81 ec 18 01 00 00    	sub    $0x118,%esp
	struct printbuf b;

	b.idx = 0;
  8001e0:	c7 85 f0 fe ff ff 00 	movl   $0x0,-0x110(%ebp)
  8001e7:	00 00 00 
	b.cnt = 0;
  8001ea:	c7 85 f4 fe ff ff 00 	movl   $0x0,-0x10c(%ebp)
  8001f1:	00 00 00 
	vprintfmt((void*)putch, &b, fmt, ap);
  8001f4:	ff 75 0c             	pushl  0xc(%ebp)
  8001f7:	ff 75 08             	pushl  0x8(%ebp)
  8001fa:	8d 85 f0 fe ff ff    	lea    -0x110(%ebp),%eax
  800200:	50                   	push   %eax
  800201:	68 8b 01 80 00       	push   $0x80018b
  800206:	e8 20 01 00 00       	call   80032b <vprintfmt>
	sys_cputs(b.buf, b.idx);
  80020b:	83 c4 08             	add    $0x8,%esp
  80020e:	ff b5 f0 fe ff ff    	pushl  -0x110(%ebp)
  800214:	8d 85 f8 fe ff ff    	lea    -0x108(%ebp),%eax
  80021a:	50                   	push   %eax
  80021b:	e8 53 09 00 00       	call   800b73 <sys_cputs>

	return b.cnt;
}
  800220:	8b 85 f4 fe ff ff    	mov    -0x10c(%ebp),%eax
  800226:	c9                   	leave  
  800227:	c3                   	ret    

00800228 <cprintf>:

int
cprintf(const char *fmt, ...)
{
  800228:	f3 0f 1e fb          	endbr32 
  80022c:	55                   	push   %ebp
  80022d:	89 e5                	mov    %esp,%ebp
  80022f:	83 ec 10             	sub    $0x10,%esp
	va_list ap;
	int cnt;

	va_start(ap, fmt);
  800232:	8d 45 0c             	lea    0xc(%ebp),%eax
	cnt = vcprintf(fmt, ap);
  800235:	50                   	push   %eax
  800236:	ff 75 08             	pushl  0x8(%ebp)
  800239:	e8 95 ff ff ff       	call   8001d3 <vcprintf>
	va_end(ap);

	return cnt;
}
  80023e:	c9                   	leave  
  80023f:	c3                   	ret    

00800240 <printnum>:
 * using specified putch function and associated pointer putdat.
 */
static void
printnum(void (*putch)(int, void*), void *putdat,
	 unsigned long long num, unsigned base, int width, int padc)
{
  800240:	55                   	push   %ebp
  800241:	89 e5                	mov    %esp,%ebp
  800243:	57                   	push   %edi
  800244:	56                   	push   %esi
  800245:	53                   	push   %ebx
  800246:	83 ec 1c             	sub    $0x1c,%esp
  800249:	89 c7                	mov    %eax,%edi
  80024b:	89 d6                	mov    %edx,%esi
  80024d:	8b 45 08             	mov    0x8(%ebp),%eax
  800250:	8b 55 0c             	mov    0xc(%ebp),%edx
  800253:	89 d1                	mov    %edx,%ecx
  800255:	89 c2                	mov    %eax,%edx
  800257:	89 45 d8             	mov    %eax,-0x28(%ebp)
  80025a:	89 4d dc             	mov    %ecx,-0x24(%ebp)
  80025d:	8b 45 10             	mov    0x10(%ebp),%eax
  800260:	8b 5d 14             	mov    0x14(%ebp),%ebx
	// first recursively print all preceding (more significant) digits
	if (num >= base) {
  800263:	89 45 e0             	mov    %eax,-0x20(%ebp)
  800266:	c7 45 e4 00 00 00 00 	movl   $0x0,-0x1c(%ebp)
  80026d:	39 c2                	cmp    %eax,%edx
  80026f:	1b 4d e4             	sbb    -0x1c(%ebp),%ecx
  800272:	72 3e                	jb     8002b2 <printnum+0x72>
		printnum(putch, putdat, num / base, base, width - 1, padc);
  800274:	83 ec 0c             	sub    $0xc,%esp
  800277:	ff 75 18             	pushl  0x18(%ebp)
  80027a:	83 eb 01             	sub    $0x1,%ebx
  80027d:	53                   	push   %ebx
  80027e:	50                   	push   %eax
  80027f:	83 ec 08             	sub    $0x8,%esp
  800282:	ff 75 e4             	pushl  -0x1c(%ebp)
  800285:	ff 75 e0             	pushl  -0x20(%ebp)
  800288:	ff 75 dc             	pushl  -0x24(%ebp)
  80028b:	ff 75 d8             	pushl  -0x28(%ebp)
  80028e:	e8 2d 1d 00 00       	call   801fc0 <__udivdi3>
  800293:	83 c4 18             	add    $0x18,%esp
  800296:	52                   	push   %edx
  800297:	50                   	push   %eax
  800298:	89 f2                	mov    %esi,%edx
  80029a:	89 f8                	mov    %edi,%eax
  80029c:	e8 9f ff ff ff       	call   800240 <printnum>
  8002a1:	83 c4 20             	add    $0x20,%esp
  8002a4:	eb 13                	jmp    8002b9 <printnum+0x79>
	} else {
		// print any needed pad characters before first digit
		while (--width > 0)
			putch(padc, putdat);
  8002a6:	83 ec 08             	sub    $0x8,%esp
  8002a9:	56                   	push   %esi
  8002aa:	ff 75 18             	pushl  0x18(%ebp)
  8002ad:	ff d7                	call   *%edi
  8002af:	83 c4 10             	add    $0x10,%esp
		while (--width > 0)
  8002b2:	83 eb 01             	sub    $0x1,%ebx
  8002b5:	85 db                	test   %ebx,%ebx
  8002b7:	7f ed                	jg     8002a6 <printnum+0x66>
	}

	// then print this (the least significant) digit
	putch("0123456789abcdef"[num % base], putdat);
  8002b9:	83 ec 08             	sub    $0x8,%esp
  8002bc:	56                   	push   %esi
  8002bd:	83 ec 04             	sub    $0x4,%esp
  8002c0:	ff 75 e4             	pushl  -0x1c(%ebp)
  8002c3:	ff 75 e0             	pushl  -0x20(%ebp)
  8002c6:	ff 75 dc             	pushl  -0x24(%ebp)
  8002c9:	ff 75 d8             	pushl  -0x28(%ebp)
  8002cc:	e8 ff 1d 00 00       	call   8020d0 <__umoddi3>
  8002d1:	83 c4 14             	add    $0x14,%esp
  8002d4:	0f be 80 66 22 80 00 	movsbl 0x802266(%eax),%eax
  8002db:	50                   	push   %eax
  8002dc:	ff d7                	call   *%edi
}
  8002de:	83 c4 10             	add    $0x10,%esp
  8002e1:	8d 65 f4             	lea    -0xc(%ebp),%esp
  8002e4:	5b                   	pop    %ebx
  8002e5:	5e                   	pop    %esi
  8002e6:	5f                   	pop    %edi
  8002e7:	5d                   	pop    %ebp
  8002e8:	c3                   	ret    

008002e9 <sprintputch>:
	int cnt;
};

static void
sprintputch(int ch, struct sprintbuf *b)
{
  8002e9:	f3 0f 1e fb          	endbr32 
  8002ed:	55                   	push   %ebp
  8002ee:	89 e5                	mov    %esp,%ebp
  8002f0:	8b 45 0c             	mov    0xc(%ebp),%eax
	b->cnt++;
  8002f3:	83 40 08 01          	addl   $0x1,0x8(%eax)
	if (b->buf < b->ebuf)
  8002f7:	8b 10                	mov    (%eax),%edx
  8002f9:	3b 50 04             	cmp    0x4(%eax),%edx
  8002fc:	73 0a                	jae    800308 <sprintputch+0x1f>
		*b->buf++ = ch;
  8002fe:	8d 4a 01             	lea    0x1(%edx),%ecx
  800301:	89 08                	mov    %ecx,(%eax)
  800303:	8b 45 08             	mov    0x8(%ebp),%eax
  800306:	88 02                	mov    %al,(%edx)
}
  800308:	5d                   	pop    %ebp
  800309:	c3                   	ret    

0080030a <printfmt>:
{
  80030a:	f3 0f 1e fb          	endbr32 
  80030e:	55                   	push   %ebp
  80030f:	89 e5                	mov    %esp,%ebp
  800311:	83 ec 08             	sub    $0x8,%esp
	va_start(ap, fmt);
  800314:	8d 45 14             	lea    0x14(%ebp),%eax
	vprintfmt(putch, putdat, fmt, ap);
  800317:	50                   	push   %eax
  800318:	ff 75 10             	pushl  0x10(%ebp)
  80031b:	ff 75 0c             	pushl  0xc(%ebp)
  80031e:	ff 75 08             	pushl  0x8(%ebp)
  800321:	e8 05 00 00 00       	call   80032b <vprintfmt>
}
  800326:	83 c4 10             	add    $0x10,%esp
  800329:	c9                   	leave  
  80032a:	c3                   	ret    

0080032b <vprintfmt>:
{
  80032b:	f3 0f 1e fb          	endbr32 
  80032f:	55                   	push   %ebp
  800330:	89 e5                	mov    %esp,%ebp
  800332:	57                   	push   %edi
  800333:	56                   	push   %esi
  800334:	53                   	push   %ebx
  800335:	83 ec 3c             	sub    $0x3c,%esp
  800338:	8b 75 08             	mov    0x8(%ebp),%esi
  80033b:	8b 5d 0c             	mov    0xc(%ebp),%ebx
  80033e:	8b 7d 10             	mov    0x10(%ebp),%edi
  800341:	e9 5d 03 00 00       	jmp    8006a3 <vprintfmt+0x378>
		padc = ' ';
  800346:	c6 45 d3 20          	movb   $0x20,-0x2d(%ebp)
		altflag = 0;
  80034a:	c7 45 e0 00 00 00 00 	movl   $0x0,-0x20(%ebp)
		precision = -1;
  800351:	c7 45 d8 ff ff ff ff 	movl   $0xffffffff,-0x28(%ebp)
		width = -1;
  800358:	c7 45 d4 ff ff ff ff 	movl   $0xffffffff,-0x2c(%ebp)
		lflag = 0;
  80035f:	b9 00 00 00 00       	mov    $0x0,%ecx
		switch (ch = *(unsigned char *) fmt++) {
  800364:	8d 47 01             	lea    0x1(%edi),%eax
  800367:	89 45 e4             	mov    %eax,-0x1c(%ebp)
  80036a:	0f b6 17             	movzbl (%edi),%edx
  80036d:	8d 42 dd             	lea    -0x23(%edx),%eax
  800370:	3c 55                	cmp    $0x55,%al
  800372:	0f 87 ae 03 00 00    	ja     800726 <vprintfmt+0x3fb>
  800378:	0f b6 c0             	movzbl %al,%eax
  80037b:	3e ff 24 85 a0 23 80 	notrack jmp *0x8023a0(,%eax,4)
  800382:	00 
  800383:	8b 7d e4             	mov    -0x1c(%ebp),%edi
			padc = '-';
  800386:	c6 45 d3 2d          	movb   $0x2d,-0x2d(%ebp)
  80038a:	eb d8                	jmp    800364 <vprintfmt+0x39>
		switch (ch = *(unsigned char *) fmt++) {
  80038c:	8b 7d e4             	mov    -0x1c(%ebp),%edi
  80038f:	c6 45 d3 30          	movb   $0x30,-0x2d(%ebp)
  800393:	eb cf                	jmp    800364 <vprintfmt+0x39>
  800395:	0f b6 d2             	movzbl %dl,%edx
  800398:	8b 7d e4             	mov    -0x1c(%ebp),%edi
			for (precision = 0; ; ++fmt) {
  80039b:	b8 00 00 00 00       	mov    $0x0,%eax
  8003a0:	89 4d e4             	mov    %ecx,-0x1c(%ebp)
				precision = precision * 10 + ch - '0';
  8003a3:	8d 04 80             	lea    (%eax,%eax,4),%eax
  8003a6:	8d 44 42 d0          	lea    -0x30(%edx,%eax,2),%eax
				ch = *fmt;
  8003aa:	0f be 17             	movsbl (%edi),%edx
				if (ch < '0' || ch > '9')
  8003ad:	8d 4a d0             	lea    -0x30(%edx),%ecx
  8003b0:	83 f9 09             	cmp    $0x9,%ecx
  8003b3:	77 55                	ja     80040a <vprintfmt+0xdf>
			for (precision = 0; ; ++fmt) {
  8003b5:	83 c7 01             	add    $0x1,%edi
				precision = precision * 10 + ch - '0';
  8003b8:	eb e9                	jmp    8003a3 <vprintfmt+0x78>
			precision = va_arg(ap, int);
  8003ba:	8b 45 14             	mov    0x14(%ebp),%eax
  8003bd:	8b 00                	mov    (%eax),%eax
  8003bf:	89 45 d8             	mov    %eax,-0x28(%ebp)
  8003c2:	8b 45 14             	mov    0x14(%ebp),%eax
  8003c5:	8d 40 04             	lea    0x4(%eax),%eax
  8003c8:	89 45 14             	mov    %eax,0x14(%ebp)
		switch (ch = *(unsigned char *) fmt++) {
  8003cb:	8b 7d e4             	mov    -0x1c(%ebp),%edi
			if (width < 0)
  8003ce:	83 7d d4 00          	cmpl   $0x0,-0x2c(%ebp)
  8003d2:	79 90                	jns    800364 <vprintfmt+0x39>
				width = precision, precision = -1;
  8003d4:	8b 45 d8             	mov    -0x28(%ebp),%eax
  8003d7:	89 45 d4             	mov    %eax,-0x2c(%ebp)
  8003da:	c7 45 d8 ff ff ff ff 	movl   $0xffffffff,-0x28(%ebp)
  8003e1:	eb 81                	jmp    800364 <vprintfmt+0x39>
  8003e3:	8b 45 d4             	mov    -0x2c(%ebp),%eax
  8003e6:	85 c0                	test   %eax,%eax
  8003e8:	ba 00 00 00 00       	mov    $0x0,%edx
  8003ed:	0f 49 d0             	cmovns %eax,%edx
  8003f0:	89 55 d4             	mov    %edx,-0x2c(%ebp)
		switch (ch = *(unsigned char *) fmt++) {
  8003f3:	8b 7d e4             	mov    -0x1c(%ebp),%edi
			goto reswitch;
  8003f6:	e9 69 ff ff ff       	jmp    800364 <vprintfmt+0x39>
		switch (ch = *(unsigned char *) fmt++) {
  8003fb:	8b 7d e4             	mov    -0x1c(%ebp),%edi
			altflag = 1;
  8003fe:	c7 45 e0 01 00 00 00 	movl   $0x1,-0x20(%ebp)
			goto reswitch;
  800405:	e9 5a ff ff ff       	jmp    800364 <vprintfmt+0x39>
  80040a:	8b 4d e4             	mov    -0x1c(%ebp),%ecx
  80040d:	89 45 d8             	mov    %eax,-0x28(%ebp)
  800410:	eb bc                	jmp    8003ce <vprintfmt+0xa3>
			lflag++;
  800412:	83 c1 01             	add    $0x1,%ecx
		switch (ch = *(unsigned char *) fmt++) {
  800415:	8b 7d e4             	mov    -0x1c(%ebp),%edi
			goto reswitch;
  800418:	e9 47 ff ff ff       	jmp    800364 <vprintfmt+0x39>
			putch(va_arg(ap, int), putdat);
  80041d:	8b 45 14             	mov    0x14(%ebp),%eax
  800420:	8d 78 04             	lea    0x4(%eax),%edi
  800423:	83 ec 08             	sub    $0x8,%esp
  800426:	53                   	push   %ebx
  800427:	ff 30                	pushl  (%eax)
  800429:	ff d6                	call   *%esi
			break;
  80042b:	83 c4 10             	add    $0x10,%esp
			putch(va_arg(ap, int), putdat);
  80042e:	89 7d 14             	mov    %edi,0x14(%ebp)
			break;
  800431:	e9 6a 02 00 00       	jmp    8006a0 <vprintfmt+0x375>
			err = va_arg(ap, int);
  800436:	8b 45 14             	mov    0x14(%ebp),%eax
  800439:	8d 78 04             	lea    0x4(%eax),%edi
  80043c:	8b 00                	mov    (%eax),%eax
  80043e:	99                   	cltd   
  80043f:	31 d0                	xor    %edx,%eax
  800441:	29 d0                	sub    %edx,%eax
			if (err >= MAXERROR || (p = error_string[err]) == NULL)
  800443:	83 f8 0f             	cmp    $0xf,%eax
  800446:	7f 23                	jg     80046b <vprintfmt+0x140>
  800448:	8b 14 85 00 25 80 00 	mov    0x802500(,%eax,4),%edx
  80044f:	85 d2                	test   %edx,%edx
  800451:	74 18                	je     80046b <vprintfmt+0x140>
				printfmt(putch, putdat, "%s", p);
  800453:	52                   	push   %edx
  800454:	68 31 26 80 00       	push   $0x802631
  800459:	53                   	push   %ebx
  80045a:	56                   	push   %esi
  80045b:	e8 aa fe ff ff       	call   80030a <printfmt>
  800460:	83 c4 10             	add    $0x10,%esp
			err = va_arg(ap, int);
  800463:	89 7d 14             	mov    %edi,0x14(%ebp)
  800466:	e9 35 02 00 00       	jmp    8006a0 <vprintfmt+0x375>
				printfmt(putch, putdat, "error %d", err);
  80046b:	50                   	push   %eax
  80046c:	68 7e 22 80 00       	push   $0x80227e
  800471:	53                   	push   %ebx
  800472:	56                   	push   %esi
  800473:	e8 92 fe ff ff       	call   80030a <printfmt>
  800478:	83 c4 10             	add    $0x10,%esp
			err = va_arg(ap, int);
  80047b:	89 7d 14             	mov    %edi,0x14(%ebp)
				printfmt(putch, putdat, "error %d", err);
  80047e:	e9 1d 02 00 00       	jmp    8006a0 <vprintfmt+0x375>
			if ((p = va_arg(ap, char *)) == NULL)
  800483:	8b 45 14             	mov    0x14(%ebp),%eax
  800486:	83 c0 04             	add    $0x4,%eax
  800489:	89 45 c8             	mov    %eax,-0x38(%ebp)
  80048c:	8b 45 14             	mov    0x14(%ebp),%eax
  80048f:	8b 10                	mov    (%eax),%edx
				p = "(null)";
  800491:	85 d2                	test   %edx,%edx
  800493:	b8 77 22 80 00       	mov    $0x802277,%eax
  800498:	0f 45 c2             	cmovne %edx,%eax
  80049b:	89 45 cc             	mov    %eax,-0x34(%ebp)
			if (width > 0 && padc != '-')
  80049e:	83 7d d4 00          	cmpl   $0x0,-0x2c(%ebp)
  8004a2:	7e 06                	jle    8004aa <vprintfmt+0x17f>
  8004a4:	80 7d d3 2d          	cmpb   $0x2d,-0x2d(%ebp)
  8004a8:	75 0d                	jne    8004b7 <vprintfmt+0x18c>
				for (width -= strnlen(p, precision); width > 0; width--)
  8004aa:	8b 45 cc             	mov    -0x34(%ebp),%eax
  8004ad:	89 c7                	mov    %eax,%edi
  8004af:	03 45 d4             	add    -0x2c(%ebp),%eax
  8004b2:	89 45 d4             	mov    %eax,-0x2c(%ebp)
  8004b5:	eb 55                	jmp    80050c <vprintfmt+0x1e1>
  8004b7:	83 ec 08             	sub    $0x8,%esp
  8004ba:	ff 75 d8             	pushl  -0x28(%ebp)
  8004bd:	ff 75 cc             	pushl  -0x34(%ebp)
  8004c0:	e8 15 03 00 00       	call   8007da <strnlen>
  8004c5:	8b 55 d4             	mov    -0x2c(%ebp),%edx
  8004c8:	29 c2                	sub    %eax,%edx
  8004ca:	89 55 c4             	mov    %edx,-0x3c(%ebp)
  8004cd:	83 c4 10             	add    $0x10,%esp
  8004d0:	89 d7                	mov    %edx,%edi
					putch(padc, putdat);
  8004d2:	0f be 45 d3          	movsbl -0x2d(%ebp),%eax
  8004d6:	89 45 d4             	mov    %eax,-0x2c(%ebp)
				for (width -= strnlen(p, precision); width > 0; width--)
  8004d9:	85 ff                	test   %edi,%edi
  8004db:	7e 11                	jle    8004ee <vprintfmt+0x1c3>
					putch(padc, putdat);
  8004dd:	83 ec 08             	sub    $0x8,%esp
  8004e0:	53                   	push   %ebx
  8004e1:	ff 75 d4             	pushl  -0x2c(%ebp)
  8004e4:	ff d6                	call   *%esi
				for (width -= strnlen(p, precision); width > 0; width--)
  8004e6:	83 ef 01             	sub    $0x1,%edi
  8004e9:	83 c4 10             	add    $0x10,%esp
  8004ec:	eb eb                	jmp    8004d9 <vprintfmt+0x1ae>
  8004ee:	8b 55 c4             	mov    -0x3c(%ebp),%edx
  8004f1:	85 d2                	test   %edx,%edx
  8004f3:	b8 00 00 00 00       	mov    $0x0,%eax
  8004f8:	0f 49 c2             	cmovns %edx,%eax
  8004fb:	29 c2                	sub    %eax,%edx
  8004fd:	89 55 d4             	mov    %edx,-0x2c(%ebp)
  800500:	eb a8                	jmp    8004aa <vprintfmt+0x17f>
					putch(ch, putdat);
  800502:	83 ec 08             	sub    $0x8,%esp
  800505:	53                   	push   %ebx
  800506:	52                   	push   %edx
  800507:	ff d6                	call   *%esi
  800509:	83 c4 10             	add    $0x10,%esp
  80050c:	8b 4d d4             	mov    -0x2c(%ebp),%ecx
  80050f:	29 f9                	sub    %edi,%ecx
			for (; (ch = *p++) != '\0' && (precision < 0 || --precision >= 0); width--)
  800511:	83 c7 01             	add    $0x1,%edi
  800514:	0f b6 47 ff          	movzbl -0x1(%edi),%eax
  800518:	0f be d0             	movsbl %al,%edx
  80051b:	85 d2                	test   %edx,%edx
  80051d:	74 4b                	je     80056a <vprintfmt+0x23f>
  80051f:	83 7d d8 00          	cmpl   $0x0,-0x28(%ebp)
  800523:	78 06                	js     80052b <vprintfmt+0x200>
  800525:	83 6d d8 01          	subl   $0x1,-0x28(%ebp)
  800529:	78 1e                	js     800549 <vprintfmt+0x21e>
				if (altflag && (ch < ' ' || ch > '~'))
  80052b:	83 7d e0 00          	cmpl   $0x0,-0x20(%ebp)
  80052f:	74 d1                	je     800502 <vprintfmt+0x1d7>
  800531:	0f be c0             	movsbl %al,%eax
  800534:	83 e8 20             	sub    $0x20,%eax
  800537:	83 f8 5e             	cmp    $0x5e,%eax
  80053a:	76 c6                	jbe    800502 <vprintfmt+0x1d7>
					putch('?', putdat);
  80053c:	83 ec 08             	sub    $0x8,%esp
  80053f:	53                   	push   %ebx
  800540:	6a 3f                	push   $0x3f
  800542:	ff d6                	call   *%esi
  800544:	83 c4 10             	add    $0x10,%esp
  800547:	eb c3                	jmp    80050c <vprintfmt+0x1e1>
  800549:	89 cf                	mov    %ecx,%edi
  80054b:	eb 0e                	jmp    80055b <vprintfmt+0x230>
				putch(' ', putdat);
  80054d:	83 ec 08             	sub    $0x8,%esp
  800550:	53                   	push   %ebx
  800551:	6a 20                	push   $0x20
  800553:	ff d6                	call   *%esi
			for (; width > 0; width--)
  800555:	83 ef 01             	sub    $0x1,%edi
  800558:	83 c4 10             	add    $0x10,%esp
  80055b:	85 ff                	test   %edi,%edi
  80055d:	7f ee                	jg     80054d <vprintfmt+0x222>
			if ((p = va_arg(ap, char *)) == NULL)
  80055f:	8b 45 c8             	mov    -0x38(%ebp),%eax
  800562:	89 45 14             	mov    %eax,0x14(%ebp)
  800565:	e9 36 01 00 00       	jmp    8006a0 <vprintfmt+0x375>
  80056a:	89 cf                	mov    %ecx,%edi
  80056c:	eb ed                	jmp    80055b <vprintfmt+0x230>
	if (lflag >= 2)
  80056e:	83 f9 01             	cmp    $0x1,%ecx
  800571:	7f 1f                	jg     800592 <vprintfmt+0x267>
	else if (lflag)
  800573:	85 c9                	test   %ecx,%ecx
  800575:	74 67                	je     8005de <vprintfmt+0x2b3>
		return va_arg(*ap, long);
  800577:	8b 45 14             	mov    0x14(%ebp),%eax
  80057a:	8b 00                	mov    (%eax),%eax
  80057c:	89 45 d8             	mov    %eax,-0x28(%ebp)
  80057f:	89 c1                	mov    %eax,%ecx
  800581:	c1 f9 1f             	sar    $0x1f,%ecx
  800584:	89 4d dc             	mov    %ecx,-0x24(%ebp)
  800587:	8b 45 14             	mov    0x14(%ebp),%eax
  80058a:	8d 40 04             	lea    0x4(%eax),%eax
  80058d:	89 45 14             	mov    %eax,0x14(%ebp)
  800590:	eb 17                	jmp    8005a9 <vprintfmt+0x27e>
		return va_arg(*ap, long long);
  800592:	8b 45 14             	mov    0x14(%ebp),%eax
  800595:	8b 50 04             	mov    0x4(%eax),%edx
  800598:	8b 00                	mov    (%eax),%eax
  80059a:	89 45 d8             	mov    %eax,-0x28(%ebp)
  80059d:	89 55 dc             	mov    %edx,-0x24(%ebp)
  8005a0:	8b 45 14             	mov    0x14(%ebp),%eax
  8005a3:	8d 40 08             	lea    0x8(%eax),%eax
  8005a6:	89 45 14             	mov    %eax,0x14(%ebp)
			if ((long long) num < 0) {
  8005a9:	8b 55 d8             	mov    -0x28(%ebp),%edx
  8005ac:	8b 4d dc             	mov    -0x24(%ebp),%ecx
			base = 10;
  8005af:	b8 0a 00 00 00       	mov    $0xa,%eax
			if ((long long) num < 0) {
  8005b4:	85 c9                	test   %ecx,%ecx
  8005b6:	0f 89 ca 00 00 00    	jns    800686 <vprintfmt+0x35b>
				putch('-', putdat);
  8005bc:	83 ec 08             	sub    $0x8,%esp
  8005bf:	53                   	push   %ebx
  8005c0:	6a 2d                	push   $0x2d
  8005c2:	ff d6                	call   *%esi
				num = -(long long) num;
  8005c4:	8b 55 d8             	mov    -0x28(%ebp),%edx
  8005c7:	8b 4d dc             	mov    -0x24(%ebp),%ecx
  8005ca:	f7 da                	neg    %edx
  8005cc:	83 d1 00             	adc    $0x0,%ecx
  8005cf:	f7 d9                	neg    %ecx
  8005d1:	83 c4 10             	add    $0x10,%esp
			base = 10;
  8005d4:	b8 0a 00 00 00       	mov    $0xa,%eax
  8005d9:	e9 a8 00 00 00       	jmp    800686 <vprintfmt+0x35b>
		return va_arg(*ap, int);
  8005de:	8b 45 14             	mov    0x14(%ebp),%eax
  8005e1:	8b 00                	mov    (%eax),%eax
  8005e3:	89 45 d8             	mov    %eax,-0x28(%ebp)
  8005e6:	99                   	cltd   
  8005e7:	89 55 dc             	mov    %edx,-0x24(%ebp)
  8005ea:	8b 45 14             	mov    0x14(%ebp),%eax
  8005ed:	8d 40 04             	lea    0x4(%eax),%eax
  8005f0:	89 45 14             	mov    %eax,0x14(%ebp)
  8005f3:	eb b4                	jmp    8005a9 <vprintfmt+0x27e>
	if (lflag >= 2)
  8005f5:	83 f9 01             	cmp    $0x1,%ecx
  8005f8:	7f 1b                	jg     800615 <vprintfmt+0x2ea>
	else if (lflag)
  8005fa:	85 c9                	test   %ecx,%ecx
  8005fc:	74 2c                	je     80062a <vprintfmt+0x2ff>
		return va_arg(*ap, unsigned long);
  8005fe:	8b 45 14             	mov    0x14(%ebp),%eax
  800601:	8b 10                	mov    (%eax),%edx
  800603:	b9 00 00 00 00       	mov    $0x0,%ecx
  800608:	8d 40 04             	lea    0x4(%eax),%eax
  80060b:	89 45 14             	mov    %eax,0x14(%ebp)
			base = 10;
  80060e:	b8 0a 00 00 00       	mov    $0xa,%eax
		return va_arg(*ap, unsigned long);
  800613:	eb 71                	jmp    800686 <vprintfmt+0x35b>
		return va_arg(*ap, unsigned long long);
  800615:	8b 45 14             	mov    0x14(%ebp),%eax
  800618:	8b 10                	mov    (%eax),%edx
  80061a:	8b 48 04             	mov    0x4(%eax),%ecx
  80061d:	8d 40 08             	lea    0x8(%eax),%eax
  800620:	89 45 14             	mov    %eax,0x14(%ebp)
			base = 10;
  800623:	b8 0a 00 00 00       	mov    $0xa,%eax
		return va_arg(*ap, unsigned long long);
  800628:	eb 5c                	jmp    800686 <vprintfmt+0x35b>
		return va_arg(*ap, unsigned int);
  80062a:	8b 45 14             	mov    0x14(%ebp),%eax
  80062d:	8b 10                	mov    (%eax),%edx
  80062f:	b9 00 00 00 00       	mov    $0x0,%ecx
  800634:	8d 40 04             	lea    0x4(%eax),%eax
  800637:	89 45 14             	mov    %eax,0x14(%ebp)
			base = 10;
  80063a:	b8 0a 00 00 00       	mov    $0xa,%eax
		return va_arg(*ap, unsigned int);
  80063f:	eb 45                	jmp    800686 <vprintfmt+0x35b>
			putch('X', putdat);
  800641:	83 ec 08             	sub    $0x8,%esp
  800644:	53                   	push   %ebx
  800645:	6a 58                	push   $0x58
  800647:	ff d6                	call   *%esi
			putch('X', putdat);
  800649:	83 c4 08             	add    $0x8,%esp
  80064c:	53                   	push   %ebx
  80064d:	6a 58                	push   $0x58
  80064f:	ff d6                	call   *%esi
			putch('X', putdat);
  800651:	83 c4 08             	add    $0x8,%esp
  800654:	53                   	push   %ebx
  800655:	6a 58                	push   $0x58
  800657:	ff d6                	call   *%esi
			break;
  800659:	83 c4 10             	add    $0x10,%esp
  80065c:	eb 42                	jmp    8006a0 <vprintfmt+0x375>
			putch('0', putdat);
  80065e:	83 ec 08             	sub    $0x8,%esp
  800661:	53                   	push   %ebx
  800662:	6a 30                	push   $0x30
  800664:	ff d6                	call   *%esi
			putch('x', putdat);
  800666:	83 c4 08             	add    $0x8,%esp
  800669:	53                   	push   %ebx
  80066a:	6a 78                	push   $0x78
  80066c:	ff d6                	call   *%esi
			num = (unsigned long long)
  80066e:	8b 45 14             	mov    0x14(%ebp),%eax
  800671:	8b 10                	mov    (%eax),%edx
  800673:	b9 00 00 00 00       	mov    $0x0,%ecx
			goto number;
  800678:	83 c4 10             	add    $0x10,%esp
				(uintptr_t) va_arg(ap, void *);
  80067b:	8d 40 04             	lea    0x4(%eax),%eax
  80067e:	89 45 14             	mov    %eax,0x14(%ebp)
			base = 16;
  800681:	b8 10 00 00 00       	mov    $0x10,%eax
			printnum(putch, putdat, num, base, width, padc);
  800686:	83 ec 0c             	sub    $0xc,%esp
  800689:	0f be 7d d3          	movsbl -0x2d(%ebp),%edi
  80068d:	57                   	push   %edi
  80068e:	ff 75 d4             	pushl  -0x2c(%ebp)
  800691:	50                   	push   %eax
  800692:	51                   	push   %ecx
  800693:	52                   	push   %edx
  800694:	89 da                	mov    %ebx,%edx
  800696:	89 f0                	mov    %esi,%eax
  800698:	e8 a3 fb ff ff       	call   800240 <printnum>
			break;
  80069d:	83 c4 20             	add    $0x20,%esp
			if ((p = va_arg(ap, char *)) == NULL)
  8006a0:	8b 7d e4             	mov    -0x1c(%ebp),%edi
		while ((ch = *(unsigned char *) fmt++) != '%') {
  8006a3:	83 c7 01             	add    $0x1,%edi
  8006a6:	0f b6 47 ff          	movzbl -0x1(%edi),%eax
  8006aa:	83 f8 25             	cmp    $0x25,%eax
  8006ad:	0f 84 93 fc ff ff    	je     800346 <vprintfmt+0x1b>
			if (ch == '\0')
  8006b3:	85 c0                	test   %eax,%eax
  8006b5:	0f 84 8b 00 00 00    	je     800746 <vprintfmt+0x41b>
			putch(ch, putdat);
  8006bb:	83 ec 08             	sub    $0x8,%esp
  8006be:	53                   	push   %ebx
  8006bf:	50                   	push   %eax
  8006c0:	ff d6                	call   *%esi
  8006c2:	83 c4 10             	add    $0x10,%esp
  8006c5:	eb dc                	jmp    8006a3 <vprintfmt+0x378>
	if (lflag >= 2)
  8006c7:	83 f9 01             	cmp    $0x1,%ecx
  8006ca:	7f 1b                	jg     8006e7 <vprintfmt+0x3bc>
	else if (lflag)
  8006cc:	85 c9                	test   %ecx,%ecx
  8006ce:	74 2c                	je     8006fc <vprintfmt+0x3d1>
		return va_arg(*ap, unsigned long);
  8006d0:	8b 45 14             	mov    0x14(%ebp),%eax
  8006d3:	8b 10                	mov    (%eax),%edx
  8006d5:	b9 00 00 00 00       	mov    $0x0,%ecx
  8006da:	8d 40 04             	lea    0x4(%eax),%eax
  8006dd:	89 45 14             	mov    %eax,0x14(%ebp)
			base = 16;
  8006e0:	b8 10 00 00 00       	mov    $0x10,%eax
		return va_arg(*ap, unsigned long);
  8006e5:	eb 9f                	jmp    800686 <vprintfmt+0x35b>
		return va_arg(*ap, unsigned long long);
  8006e7:	8b 45 14             	mov    0x14(%ebp),%eax
  8006ea:	8b 10                	mov    (%eax),%edx
  8006ec:	8b 48 04             	mov    0x4(%eax),%ecx
  8006ef:	8d 40 08             	lea    0x8(%eax),%eax
  8006f2:	89 45 14             	mov    %eax,0x14(%ebp)
			base = 16;
  8006f5:	b8 10 00 00 00       	mov    $0x10,%eax
		return va_arg(*ap, unsigned long long);
  8006fa:	eb 8a                	jmp    800686 <vprintfmt+0x35b>
		return va_arg(*ap, unsigned int);
  8006fc:	8b 45 14             	mov    0x14(%ebp),%eax
  8006ff:	8b 10                	mov    (%eax),%edx
  800701:	b9 00 00 00 00       	mov    $0x0,%ecx
  800706:	8d 40 04             	lea    0x4(%eax),%eax
  800709:	89 45 14             	mov    %eax,0x14(%ebp)
			base = 16;
  80070c:	b8 10 00 00 00       	mov    $0x10,%eax
		return va_arg(*ap, unsigned int);
  800711:	e9 70 ff ff ff       	jmp    800686 <vprintfmt+0x35b>
			putch(ch, putdat);
  800716:	83 ec 08             	sub    $0x8,%esp
  800719:	53                   	push   %ebx
  80071a:	6a 25                	push   $0x25
  80071c:	ff d6                	call   *%esi
			break;
  80071e:	83 c4 10             	add    $0x10,%esp
  800721:	e9 7a ff ff ff       	jmp    8006a0 <vprintfmt+0x375>
			putch('%', putdat);
  800726:	83 ec 08             	sub    $0x8,%esp
  800729:	53                   	push   %ebx
  80072a:	6a 25                	push   $0x25
  80072c:	ff d6                	call   *%esi
			for (fmt--; fmt[-1] != '%'; fmt--)
  80072e:	83 c4 10             	add    $0x10,%esp
  800731:	89 f8                	mov    %edi,%eax
  800733:	80 78 ff 25          	cmpb   $0x25,-0x1(%eax)
  800737:	74 05                	je     80073e <vprintfmt+0x413>
  800739:	83 e8 01             	sub    $0x1,%eax
  80073c:	eb f5                	jmp    800733 <vprintfmt+0x408>
  80073e:	89 45 e4             	mov    %eax,-0x1c(%ebp)
  800741:	e9 5a ff ff ff       	jmp    8006a0 <vprintfmt+0x375>
}
  800746:	8d 65 f4             	lea    -0xc(%ebp),%esp
  800749:	5b                   	pop    %ebx
  80074a:	5e                   	pop    %esi
  80074b:	5f                   	pop    %edi
  80074c:	5d                   	pop    %ebp
  80074d:	c3                   	ret    

0080074e <vsnprintf>:

int
vsnprintf(char *buf, int n, const char *fmt, va_list ap)
{
  80074e:	f3 0f 1e fb          	endbr32 
  800752:	55                   	push   %ebp
  800753:	89 e5                	mov    %esp,%ebp
  800755:	83 ec 18             	sub    $0x18,%esp
  800758:	8b 45 08             	mov    0x8(%ebp),%eax
  80075b:	8b 55 0c             	mov    0xc(%ebp),%edx
	struct sprintbuf b = {buf, buf+n-1, 0};
  80075e:	89 45 ec             	mov    %eax,-0x14(%ebp)
  800761:	8d 4c 10 ff          	lea    -0x1(%eax,%edx,1),%ecx
  800765:	89 4d f0             	mov    %ecx,-0x10(%ebp)
  800768:	c7 45 f4 00 00 00 00 	movl   $0x0,-0xc(%ebp)

	if (buf == NULL || n < 1)
  80076f:	85 c0                	test   %eax,%eax
  800771:	74 26                	je     800799 <vsnprintf+0x4b>
  800773:	85 d2                	test   %edx,%edx
  800775:	7e 22                	jle    800799 <vsnprintf+0x4b>
		return -E_INVAL;

	// print the string to the buffer
	vprintfmt((void*)sprintputch, &b, fmt, ap);
  800777:	ff 75 14             	pushl  0x14(%ebp)
  80077a:	ff 75 10             	pushl  0x10(%ebp)
  80077d:	8d 45 ec             	lea    -0x14(%ebp),%eax
  800780:	50                   	push   %eax
  800781:	68 e9 02 80 00       	push   $0x8002e9
  800786:	e8 a0 fb ff ff       	call   80032b <vprintfmt>

	// null terminate the buffer
	*b.buf = '\0';
  80078b:	8b 45 ec             	mov    -0x14(%ebp),%eax
  80078e:	c6 00 00             	movb   $0x0,(%eax)

	return b.cnt;
  800791:	8b 45 f4             	mov    -0xc(%ebp),%eax
  800794:	83 c4 10             	add    $0x10,%esp
}
  800797:	c9                   	leave  
  800798:	c3                   	ret    
		return -E_INVAL;
  800799:	b8 fd ff ff ff       	mov    $0xfffffffd,%eax
  80079e:	eb f7                	jmp    800797 <vsnprintf+0x49>

008007a0 <snprintf>:

int
snprintf(char *buf, int n, const char *fmt, ...)
{
  8007a0:	f3 0f 1e fb          	endbr32 
  8007a4:	55                   	push   %ebp
  8007a5:	89 e5                	mov    %esp,%ebp
  8007a7:	83 ec 08             	sub    $0x8,%esp
	va_list ap;
	int rc;

	va_start(ap, fmt);
  8007aa:	8d 45 14             	lea    0x14(%ebp),%eax
	rc = vsnprintf(buf, n, fmt, ap);
  8007ad:	50                   	push   %eax
  8007ae:	ff 75 10             	pushl  0x10(%ebp)
  8007b1:	ff 75 0c             	pushl  0xc(%ebp)
  8007b4:	ff 75 08             	pushl  0x8(%ebp)
  8007b7:	e8 92 ff ff ff       	call   80074e <vsnprintf>
	va_end(ap);

	return rc;
}
  8007bc:	c9                   	leave  
  8007bd:	c3                   	ret    

008007be <strlen>:
// Primespipe runs 3x faster this way.
#define ASM 1

int
strlen(const char *s)
{
  8007be:	f3 0f 1e fb          	endbr32 
  8007c2:	55                   	push   %ebp
  8007c3:	89 e5                	mov    %esp,%ebp
  8007c5:	8b 55 08             	mov    0x8(%ebp),%edx
	int n;

	for (n = 0; *s != '\0'; s++)
  8007c8:	b8 00 00 00 00       	mov    $0x0,%eax
  8007cd:	80 3c 02 00          	cmpb   $0x0,(%edx,%eax,1)
  8007d1:	74 05                	je     8007d8 <strlen+0x1a>
		n++;
  8007d3:	83 c0 01             	add    $0x1,%eax
  8007d6:	eb f5                	jmp    8007cd <strlen+0xf>
	return n;
}
  8007d8:	5d                   	pop    %ebp
  8007d9:	c3                   	ret    

008007da <strnlen>:

int
strnlen(const char *s, size_t size)
{
  8007da:	f3 0f 1e fb          	endbr32 
  8007de:	55                   	push   %ebp
  8007df:	89 e5                	mov    %esp,%ebp
  8007e1:	8b 4d 08             	mov    0x8(%ebp),%ecx
  8007e4:	8b 55 0c             	mov    0xc(%ebp),%edx
	int n;

	for (n = 0; size > 0 && *s != '\0'; s++, size--)
  8007e7:	b8 00 00 00 00       	mov    $0x0,%eax
  8007ec:	39 d0                	cmp    %edx,%eax
  8007ee:	74 0d                	je     8007fd <strnlen+0x23>
  8007f0:	80 3c 01 00          	cmpb   $0x0,(%ecx,%eax,1)
  8007f4:	74 05                	je     8007fb <strnlen+0x21>
		n++;
  8007f6:	83 c0 01             	add    $0x1,%eax
  8007f9:	eb f1                	jmp    8007ec <strnlen+0x12>
  8007fb:	89 c2                	mov    %eax,%edx
	return n;
}
  8007fd:	89 d0                	mov    %edx,%eax
  8007ff:	5d                   	pop    %ebp
  800800:	c3                   	ret    

00800801 <strcpy>:

char *
strcpy(char *dst, const char *src)
{
  800801:	f3 0f 1e fb          	endbr32 
  800805:	55                   	push   %ebp
  800806:	89 e5                	mov    %esp,%ebp
  800808:	53                   	push   %ebx
  800809:	8b 4d 08             	mov    0x8(%ebp),%ecx
  80080c:	8b 5d 0c             	mov    0xc(%ebp),%ebx
	char *ret;

	ret = dst;
	while ((*dst++ = *src++) != '\0')
  80080f:	b8 00 00 00 00       	mov    $0x0,%eax
  800814:	0f b6 14 03          	movzbl (%ebx,%eax,1),%edx
  800818:	88 14 01             	mov    %dl,(%ecx,%eax,1)
  80081b:	83 c0 01             	add    $0x1,%eax
  80081e:	84 d2                	test   %dl,%dl
  800820:	75 f2                	jne    800814 <strcpy+0x13>
		/* do nothing */;
	return ret;
}
  800822:	89 c8                	mov    %ecx,%eax
  800824:	5b                   	pop    %ebx
  800825:	5d                   	pop    %ebp
  800826:	c3                   	ret    

00800827 <strcat>:

char *
strcat(char *dst, const char *src)
{
  800827:	f3 0f 1e fb          	endbr32 
  80082b:	55                   	push   %ebp
  80082c:	89 e5                	mov    %esp,%ebp
  80082e:	53                   	push   %ebx
  80082f:	83 ec 10             	sub    $0x10,%esp
  800832:	8b 5d 08             	mov    0x8(%ebp),%ebx
	int len = strlen(dst);
  800835:	53                   	push   %ebx
  800836:	e8 83 ff ff ff       	call   8007be <strlen>
  80083b:	83 c4 08             	add    $0x8,%esp
	strcpy(dst + len, src);
  80083e:	ff 75 0c             	pushl  0xc(%ebp)
  800841:	01 d8                	add    %ebx,%eax
  800843:	50                   	push   %eax
  800844:	e8 b8 ff ff ff       	call   800801 <strcpy>
	return dst;
}
  800849:	89 d8                	mov    %ebx,%eax
  80084b:	8b 5d fc             	mov    -0x4(%ebp),%ebx
  80084e:	c9                   	leave  
  80084f:	c3                   	ret    

00800850 <strncpy>:

char *
strncpy(char *dst, const char *src, size_t size) {
  800850:	f3 0f 1e fb          	endbr32 
  800854:	55                   	push   %ebp
  800855:	89 e5                	mov    %esp,%ebp
  800857:	56                   	push   %esi
  800858:	53                   	push   %ebx
  800859:	8b 75 08             	mov    0x8(%ebp),%esi
  80085c:	8b 55 0c             	mov    0xc(%ebp),%edx
  80085f:	89 f3                	mov    %esi,%ebx
  800861:	03 5d 10             	add    0x10(%ebp),%ebx
	size_t i;
	char *ret;

	ret = dst;
	for (i = 0; i < size; i++) {
  800864:	89 f0                	mov    %esi,%eax
  800866:	39 d8                	cmp    %ebx,%eax
  800868:	74 11                	je     80087b <strncpy+0x2b>
		*dst++ = *src;
  80086a:	83 c0 01             	add    $0x1,%eax
  80086d:	0f b6 0a             	movzbl (%edx),%ecx
  800870:	88 48 ff             	mov    %cl,-0x1(%eax)
		// If strlen(src) < size, null-pad 'dst' out to 'size' chars
		if (*src != '\0')
			src++;
  800873:	80 f9 01             	cmp    $0x1,%cl
  800876:	83 da ff             	sbb    $0xffffffff,%edx
  800879:	eb eb                	jmp    800866 <strncpy+0x16>
	}
	return ret;
}
  80087b:	89 f0                	mov    %esi,%eax
  80087d:	5b                   	pop    %ebx
  80087e:	5e                   	pop    %esi
  80087f:	5d                   	pop    %ebp
  800880:	c3                   	ret    

00800881 <strlcpy>:

size_t
strlcpy(char *dst, const char *src, size_t size)
{
  800881:	f3 0f 1e fb          	endbr32 
  800885:	55                   	push   %ebp
  800886:	89 e5                	mov    %esp,%ebp
  800888:	56                   	push   %esi
  800889:	53                   	push   %ebx
  80088a:	8b 75 08             	mov    0x8(%ebp),%esi
  80088d:	8b 4d 0c             	mov    0xc(%ebp),%ecx
  800890:	8b 55 10             	mov    0x10(%ebp),%edx
  800893:	89 f0                	mov    %esi,%eax
	char *dst_in;

	dst_in = dst;
	if (size > 0) {
  800895:	85 d2                	test   %edx,%edx
  800897:	74 21                	je     8008ba <strlcpy+0x39>
  800899:	8d 44 16 ff          	lea    -0x1(%esi,%edx,1),%eax
  80089d:	89 f2                	mov    %esi,%edx
		while (--size > 0 && *src != '\0')
  80089f:	39 c2                	cmp    %eax,%edx
  8008a1:	74 14                	je     8008b7 <strlcpy+0x36>
  8008a3:	0f b6 19             	movzbl (%ecx),%ebx
  8008a6:	84 db                	test   %bl,%bl
  8008a8:	74 0b                	je     8008b5 <strlcpy+0x34>
			*dst++ = *src++;
  8008aa:	83 c1 01             	add    $0x1,%ecx
  8008ad:	83 c2 01             	add    $0x1,%edx
  8008b0:	88 5a ff             	mov    %bl,-0x1(%edx)
  8008b3:	eb ea                	jmp    80089f <strlcpy+0x1e>
  8008b5:	89 d0                	mov    %edx,%eax
		*dst = '\0';
  8008b7:	c6 00 00             	movb   $0x0,(%eax)
	}
	return dst - dst_in;
  8008ba:	29 f0                	sub    %esi,%eax
}
  8008bc:	5b                   	pop    %ebx
  8008bd:	5e                   	pop    %esi
  8008be:	5d                   	pop    %ebp
  8008bf:	c3                   	ret    

008008c0 <strcmp>:

int
strcmp(const char *p, const char *q)
{
  8008c0:	f3 0f 1e fb          	endbr32 
  8008c4:	55                   	push   %ebp
  8008c5:	89 e5                	mov    %esp,%ebp
  8008c7:	8b 4d 08             	mov    0x8(%ebp),%ecx
  8008ca:	8b 55 0c             	mov    0xc(%ebp),%edx
	while (*p && *p == *q)
  8008cd:	0f b6 01             	movzbl (%ecx),%eax
  8008d0:	84 c0                	test   %al,%al
  8008d2:	74 0c                	je     8008e0 <strcmp+0x20>
  8008d4:	3a 02                	cmp    (%edx),%al
  8008d6:	75 08                	jne    8008e0 <strcmp+0x20>
		p++, q++;
  8008d8:	83 c1 01             	add    $0x1,%ecx
  8008db:	83 c2 01             	add    $0x1,%edx
  8008de:	eb ed                	jmp    8008cd <strcmp+0xd>
	return (int) ((unsigned char) *p - (unsigned char) *q);
  8008e0:	0f b6 c0             	movzbl %al,%eax
  8008e3:	0f b6 12             	movzbl (%edx),%edx
  8008e6:	29 d0                	sub    %edx,%eax
}
  8008e8:	5d                   	pop    %ebp
  8008e9:	c3                   	ret    

008008ea <strncmp>:

int
strncmp(const char *p, const char *q, size_t n)
{
  8008ea:	f3 0f 1e fb          	endbr32 
  8008ee:	55                   	push   %ebp
  8008ef:	89 e5                	mov    %esp,%ebp
  8008f1:	53                   	push   %ebx
  8008f2:	8b 45 08             	mov    0x8(%ebp),%eax
  8008f5:	8b 55 0c             	mov    0xc(%ebp),%edx
  8008f8:	89 c3                	mov    %eax,%ebx
  8008fa:	03 5d 10             	add    0x10(%ebp),%ebx
	while (n > 0 && *p && *p == *q)
  8008fd:	eb 06                	jmp    800905 <strncmp+0x1b>
		n--, p++, q++;
  8008ff:	83 c0 01             	add    $0x1,%eax
  800902:	83 c2 01             	add    $0x1,%edx
	while (n > 0 && *p && *p == *q)
  800905:	39 d8                	cmp    %ebx,%eax
  800907:	74 16                	je     80091f <strncmp+0x35>
  800909:	0f b6 08             	movzbl (%eax),%ecx
  80090c:	84 c9                	test   %cl,%cl
  80090e:	74 04                	je     800914 <strncmp+0x2a>
  800910:	3a 0a                	cmp    (%edx),%cl
  800912:	74 eb                	je     8008ff <strncmp+0x15>
	if (n == 0)
		return 0;
	else
		return (int) ((unsigned char) *p - (unsigned char) *q);
  800914:	0f b6 00             	movzbl (%eax),%eax
  800917:	0f b6 12             	movzbl (%edx),%edx
  80091a:	29 d0                	sub    %edx,%eax
}
  80091c:	5b                   	pop    %ebx
  80091d:	5d                   	pop    %ebp
  80091e:	c3                   	ret    
		return 0;
  80091f:	b8 00 00 00 00       	mov    $0x0,%eax
  800924:	eb f6                	jmp    80091c <strncmp+0x32>

00800926 <strchr>:

// Return a pointer to the first occurrence of 'c' in 's',
// or a null pointer if the string has no 'c'.
char *
strchr(const char *s, char c)
{
  800926:	f3 0f 1e fb          	endbr32 
  80092a:	55                   	push   %ebp
  80092b:	89 e5                	mov    %esp,%ebp
  80092d:	8b 45 08             	mov    0x8(%ebp),%eax
  800930:	0f b6 4d 0c          	movzbl 0xc(%ebp),%ecx
	for (; *s; s++)
  800934:	0f b6 10             	movzbl (%eax),%edx
  800937:	84 d2                	test   %dl,%dl
  800939:	74 09                	je     800944 <strchr+0x1e>
		if (*s == c)
  80093b:	38 ca                	cmp    %cl,%dl
  80093d:	74 0a                	je     800949 <strchr+0x23>
	for (; *s; s++)
  80093f:	83 c0 01             	add    $0x1,%eax
  800942:	eb f0                	jmp    800934 <strchr+0xe>
			return (char *) s;
	return 0;
  800944:	b8 00 00 00 00       	mov    $0x0,%eax
}
  800949:	5d                   	pop    %ebp
  80094a:	c3                   	ret    

0080094b <strfind>:

// Return a pointer to the first occurrence of 'c' in 's',
// or a pointer to the string-ending null character if the string has no 'c'.
char *
strfind(const char *s, char c)
{
  80094b:	f3 0f 1e fb          	endbr32 
  80094f:	55                   	push   %ebp
  800950:	89 e5                	mov    %esp,%ebp
  800952:	8b 45 08             	mov    0x8(%ebp),%eax
  800955:	0f b6 4d 0c          	movzbl 0xc(%ebp),%ecx
	for (; *s; s++)
  800959:	0f b6 10             	movzbl (%eax),%edx
		if (*s == c)
  80095c:	38 ca                	cmp    %cl,%dl
  80095e:	74 09                	je     800969 <strfind+0x1e>
  800960:	84 d2                	test   %dl,%dl
  800962:	74 05                	je     800969 <strfind+0x1e>
	for (; *s; s++)
  800964:	83 c0 01             	add    $0x1,%eax
  800967:	eb f0                	jmp    800959 <strfind+0xe>
			break;
	return (char *) s;
}
  800969:	5d                   	pop    %ebp
  80096a:	c3                   	ret    

0080096b <memset>:

#if ASM
void *
memset(void *v, int c, size_t n)
{
  80096b:	f3 0f 1e fb          	endbr32 
  80096f:	55                   	push   %ebp
  800970:	89 e5                	mov    %esp,%ebp
  800972:	57                   	push   %edi
  800973:	56                   	push   %esi
  800974:	53                   	push   %ebx
  800975:	8b 7d 08             	mov    0x8(%ebp),%edi
  800978:	8b 4d 10             	mov    0x10(%ebp),%ecx
	char *p;

	if (n == 0)
  80097b:	85 c9                	test   %ecx,%ecx
  80097d:	74 31                	je     8009b0 <memset+0x45>
		return v;
	if ((int)v%4 == 0 && n%4 == 0) {
  80097f:	89 f8                	mov    %edi,%eax
  800981:	09 c8                	or     %ecx,%eax
  800983:	a8 03                	test   $0x3,%al
  800985:	75 23                	jne    8009aa <memset+0x3f>
		c &= 0xFF;
  800987:	0f b6 55 0c          	movzbl 0xc(%ebp),%edx
		c = (c<<24)|(c<<16)|(c<<8)|c;
  80098b:	89 d3                	mov    %edx,%ebx
  80098d:	c1 e3 08             	shl    $0x8,%ebx
  800990:	89 d0                	mov    %edx,%eax
  800992:	c1 e0 18             	shl    $0x18,%eax
  800995:	89 d6                	mov    %edx,%esi
  800997:	c1 e6 10             	shl    $0x10,%esi
  80099a:	09 f0                	or     %esi,%eax
  80099c:	09 c2                	or     %eax,%edx
  80099e:	09 da                	or     %ebx,%edx
		asm volatile("cld; rep stosl\n"
			:: "D" (v), "a" (c), "c" (n/4)
  8009a0:	c1 e9 02             	shr    $0x2,%ecx
		asm volatile("cld; rep stosl\n"
  8009a3:	89 d0                	mov    %edx,%eax
  8009a5:	fc                   	cld    
  8009a6:	f3 ab                	rep stos %eax,%es:(%edi)
  8009a8:	eb 06                	jmp    8009b0 <memset+0x45>
			: "cc", "memory");
	} else
		asm volatile("cld; rep stosb\n"
  8009aa:	8b 45 0c             	mov    0xc(%ebp),%eax
  8009ad:	fc                   	cld    
  8009ae:	f3 aa                	rep stos %al,%es:(%edi)
			:: "D" (v), "a" (c), "c" (n)
			: "cc", "memory");
	return v;
}
  8009b0:	89 f8                	mov    %edi,%eax
  8009b2:	5b                   	pop    %ebx
  8009b3:	5e                   	pop    %esi
  8009b4:	5f                   	pop    %edi
  8009b5:	5d                   	pop    %ebp
  8009b6:	c3                   	ret    

008009b7 <memmove>:

void *
memmove(void *dst, const void *src, size_t n)
{
  8009b7:	f3 0f 1e fb          	endbr32 
  8009bb:	55                   	push   %ebp
  8009bc:	89 e5                	mov    %esp,%ebp
  8009be:	57                   	push   %edi
  8009bf:	56                   	push   %esi
  8009c0:	8b 45 08             	mov    0x8(%ebp),%eax
  8009c3:	8b 75 0c             	mov    0xc(%ebp),%esi
  8009c6:	8b 4d 10             	mov    0x10(%ebp),%ecx
	const char *s;
	char *d;

	s = src;
	d = dst;
	if (s < d && s + n > d) {
  8009c9:	39 c6                	cmp    %eax,%esi
  8009cb:	73 32                	jae    8009ff <memmove+0x48>
  8009cd:	8d 14 0e             	lea    (%esi,%ecx,1),%edx
  8009d0:	39 c2                	cmp    %eax,%edx
  8009d2:	76 2b                	jbe    8009ff <memmove+0x48>
		s += n;
		d += n;
  8009d4:	8d 3c 08             	lea    (%eax,%ecx,1),%edi
		if ((int)s%4 == 0 && (int)d%4 == 0 && n%4 == 0)
  8009d7:	89 fe                	mov    %edi,%esi
  8009d9:	09 ce                	or     %ecx,%esi
  8009db:	09 d6                	or     %edx,%esi
  8009dd:	f7 c6 03 00 00 00    	test   $0x3,%esi
  8009e3:	75 0e                	jne    8009f3 <memmove+0x3c>
			asm volatile("std; rep movsl\n"
				:: "D" (d-4), "S" (s-4), "c" (n/4) : "cc", "memory");
  8009e5:	83 ef 04             	sub    $0x4,%edi
  8009e8:	8d 72 fc             	lea    -0x4(%edx),%esi
  8009eb:	c1 e9 02             	shr    $0x2,%ecx
			asm volatile("std; rep movsl\n"
  8009ee:	fd                   	std    
  8009ef:	f3 a5                	rep movsl %ds:(%esi),%es:(%edi)
  8009f1:	eb 09                	jmp    8009fc <memmove+0x45>
		else
			asm volatile("std; rep movsb\n"
				:: "D" (d-1), "S" (s-1), "c" (n) : "cc", "memory");
  8009f3:	83 ef 01             	sub    $0x1,%edi
  8009f6:	8d 72 ff             	lea    -0x1(%edx),%esi
			asm volatile("std; rep movsb\n"
  8009f9:	fd                   	std    
  8009fa:	f3 a4                	rep movsb %ds:(%esi),%es:(%edi)
		// Some versions of GCC rely on DF being clear
		asm volatile("cld" ::: "cc");
  8009fc:	fc                   	cld    
  8009fd:	eb 1a                	jmp    800a19 <memmove+0x62>
	} else {
		if ((int)s%4 == 0 && (int)d%4 == 0 && n%4 == 0)
  8009ff:	89 c2                	mov    %eax,%edx
  800a01:	09 ca                	or     %ecx,%edx
  800a03:	09 f2                	or     %esi,%edx
  800a05:	f6 c2 03             	test   $0x3,%dl
  800a08:	75 0a                	jne    800a14 <memmove+0x5d>
			asm volatile("cld; rep movsl\n"
				:: "D" (d), "S" (s), "c" (n/4) : "cc", "memory");
  800a0a:	c1 e9 02             	shr    $0x2,%ecx
			asm volatile("cld; rep movsl\n"
  800a0d:	89 c7                	mov    %eax,%edi
  800a0f:	fc                   	cld    
  800a10:	f3 a5                	rep movsl %ds:(%esi),%es:(%edi)
  800a12:	eb 05                	jmp    800a19 <memmove+0x62>
		else
			asm volatile("cld; rep movsb\n"
  800a14:	89 c7                	mov    %eax,%edi
  800a16:	fc                   	cld    
  800a17:	f3 a4                	rep movsb %ds:(%esi),%es:(%edi)
				:: "D" (d), "S" (s), "c" (n) : "cc", "memory");
	}
	return dst;
}
  800a19:	5e                   	pop    %esi
  800a1a:	5f                   	pop    %edi
  800a1b:	5d                   	pop    %ebp
  800a1c:	c3                   	ret    

00800a1d <memcpy>:
}
#endif

void *
memcpy(void *dst, const void *src, size_t n)
{
  800a1d:	f3 0f 1e fb          	endbr32 
  800a21:	55                   	push   %ebp
  800a22:	89 e5                	mov    %esp,%ebp
  800a24:	83 ec 0c             	sub    $0xc,%esp
	return memmove(dst, src, n);
  800a27:	ff 75 10             	pushl  0x10(%ebp)
  800a2a:	ff 75 0c             	pushl  0xc(%ebp)
  800a2d:	ff 75 08             	pushl  0x8(%ebp)
  800a30:	e8 82 ff ff ff       	call   8009b7 <memmove>
}
  800a35:	c9                   	leave  
  800a36:	c3                   	ret    

00800a37 <memcmp>:

int
memcmp(const void *v1, const void *v2, size_t n)
{
  800a37:	f3 0f 1e fb          	endbr32 
  800a3b:	55                   	push   %ebp
  800a3c:	89 e5                	mov    %esp,%ebp
  800a3e:	56                   	push   %esi
  800a3f:	53                   	push   %ebx
  800a40:	8b 45 08             	mov    0x8(%ebp),%eax
  800a43:	8b 55 0c             	mov    0xc(%ebp),%edx
  800a46:	89 c6                	mov    %eax,%esi
  800a48:	03 75 10             	add    0x10(%ebp),%esi
	const uint8_t *s1 = (const uint8_t *) v1;
	const uint8_t *s2 = (const uint8_t *) v2;

	while (n-- > 0) {
  800a4b:	39 f0                	cmp    %esi,%eax
  800a4d:	74 1c                	je     800a6b <memcmp+0x34>
		if (*s1 != *s2)
  800a4f:	0f b6 08             	movzbl (%eax),%ecx
  800a52:	0f b6 1a             	movzbl (%edx),%ebx
  800a55:	38 d9                	cmp    %bl,%cl
  800a57:	75 08                	jne    800a61 <memcmp+0x2a>
			return (int) *s1 - (int) *s2;
		s1++, s2++;
  800a59:	83 c0 01             	add    $0x1,%eax
  800a5c:	83 c2 01             	add    $0x1,%edx
  800a5f:	eb ea                	jmp    800a4b <memcmp+0x14>
			return (int) *s1 - (int) *s2;
  800a61:	0f b6 c1             	movzbl %cl,%eax
  800a64:	0f b6 db             	movzbl %bl,%ebx
  800a67:	29 d8                	sub    %ebx,%eax
  800a69:	eb 05                	jmp    800a70 <memcmp+0x39>
	}

	return 0;
  800a6b:	b8 00 00 00 00       	mov    $0x0,%eax
}
  800a70:	5b                   	pop    %ebx
  800a71:	5e                   	pop    %esi
  800a72:	5d                   	pop    %ebp
  800a73:	c3                   	ret    

00800a74 <memfind>:

void *
memfind(const void *s, int c, size_t n)
{
  800a74:	f3 0f 1e fb          	endbr32 
  800a78:	55                   	push   %ebp
  800a79:	89 e5                	mov    %esp,%ebp
  800a7b:	8b 45 08             	mov    0x8(%ebp),%eax
  800a7e:	8b 4d 0c             	mov    0xc(%ebp),%ecx
	const void *ends = (const char *) s + n;
  800a81:	89 c2                	mov    %eax,%edx
  800a83:	03 55 10             	add    0x10(%ebp),%edx
	for (; s < ends; s++)
  800a86:	39 d0                	cmp    %edx,%eax
  800a88:	73 09                	jae    800a93 <memfind+0x1f>
		if (*(const unsigned char *) s == (unsigned char) c)
  800a8a:	38 08                	cmp    %cl,(%eax)
  800a8c:	74 05                	je     800a93 <memfind+0x1f>
	for (; s < ends; s++)
  800a8e:	83 c0 01             	add    $0x1,%eax
  800a91:	eb f3                	jmp    800a86 <memfind+0x12>
			break;
	return (void *) s;
}
  800a93:	5d                   	pop    %ebp
  800a94:	c3                   	ret    

00800a95 <strtol>:

long
strtol(const char *s, char **endptr, int base)
{
  800a95:	f3 0f 1e fb          	endbr32 
  800a99:	55                   	push   %ebp
  800a9a:	89 e5                	mov    %esp,%ebp
  800a9c:	57                   	push   %edi
  800a9d:	56                   	push   %esi
  800a9e:	53                   	push   %ebx
  800a9f:	8b 4d 08             	mov    0x8(%ebp),%ecx
  800aa2:	8b 5d 10             	mov    0x10(%ebp),%ebx
	int neg = 0;
	long val = 0;

	// gobble initial whitespace
	while (*s == ' ' || *s == '\t')
  800aa5:	eb 03                	jmp    800aaa <strtol+0x15>
		s++;
  800aa7:	83 c1 01             	add    $0x1,%ecx
	while (*s == ' ' || *s == '\t')
  800aaa:	0f b6 01             	movzbl (%ecx),%eax
  800aad:	3c 20                	cmp    $0x20,%al
  800aaf:	74 f6                	je     800aa7 <strtol+0x12>
  800ab1:	3c 09                	cmp    $0x9,%al
  800ab3:	74 f2                	je     800aa7 <strtol+0x12>

	// plus/minus sign
	if (*s == '+')
  800ab5:	3c 2b                	cmp    $0x2b,%al
  800ab7:	74 2a                	je     800ae3 <strtol+0x4e>
	int neg = 0;
  800ab9:	bf 00 00 00 00       	mov    $0x0,%edi
		s++;
	else if (*s == '-')
  800abe:	3c 2d                	cmp    $0x2d,%al
  800ac0:	74 2b                	je     800aed <strtol+0x58>
		s++, neg = 1;

	// hex or octal base prefix
	if ((base == 0 || base == 16) && (s[0] == '0' && s[1] == 'x'))
  800ac2:	f7 c3 ef ff ff ff    	test   $0xffffffef,%ebx
  800ac8:	75 0f                	jne    800ad9 <strtol+0x44>
  800aca:	80 39 30             	cmpb   $0x30,(%ecx)
  800acd:	74 28                	je     800af7 <strtol+0x62>
		s += 2, base = 16;
	else if (base == 0 && s[0] == '0')
		s++, base = 8;
	else if (base == 0)
		base = 10;
  800acf:	85 db                	test   %ebx,%ebx
  800ad1:	b8 0a 00 00 00       	mov    $0xa,%eax
  800ad6:	0f 44 d8             	cmove  %eax,%ebx
  800ad9:	b8 00 00 00 00       	mov    $0x0,%eax
  800ade:	89 5d 10             	mov    %ebx,0x10(%ebp)
  800ae1:	eb 46                	jmp    800b29 <strtol+0x94>
		s++;
  800ae3:	83 c1 01             	add    $0x1,%ecx
	int neg = 0;
  800ae6:	bf 00 00 00 00       	mov    $0x0,%edi
  800aeb:	eb d5                	jmp    800ac2 <strtol+0x2d>
		s++, neg = 1;
  800aed:	83 c1 01             	add    $0x1,%ecx
  800af0:	bf 01 00 00 00       	mov    $0x1,%edi
  800af5:	eb cb                	jmp    800ac2 <strtol+0x2d>
	if ((base == 0 || base == 16) && (s[0] == '0' && s[1] == 'x'))
  800af7:	80 79 01 78          	cmpb   $0x78,0x1(%ecx)
  800afb:	74 0e                	je     800b0b <strtol+0x76>
	else if (base == 0 && s[0] == '0')
  800afd:	85 db                	test   %ebx,%ebx
  800aff:	75 d8                	jne    800ad9 <strtol+0x44>
		s++, base = 8;
  800b01:	83 c1 01             	add    $0x1,%ecx
  800b04:	bb 08 00 00 00       	mov    $0x8,%ebx
  800b09:	eb ce                	jmp    800ad9 <strtol+0x44>
		s += 2, base = 16;
  800b0b:	83 c1 02             	add    $0x2,%ecx
  800b0e:	bb 10 00 00 00       	mov    $0x10,%ebx
  800b13:	eb c4                	jmp    800ad9 <strtol+0x44>
	// digits
	while (1) {
		int dig;

		if (*s >= '0' && *s <= '9')
			dig = *s - '0';
  800b15:	0f be d2             	movsbl %dl,%edx
  800b18:	83 ea 30             	sub    $0x30,%edx
			dig = *s - 'a' + 10;
		else if (*s >= 'A' && *s <= 'Z')
			dig = *s - 'A' + 10;
		else
			break;
		if (dig >= base)
  800b1b:	3b 55 10             	cmp    0x10(%ebp),%edx
  800b1e:	7d 3a                	jge    800b5a <strtol+0xc5>
			break;
		s++, val = (val * base) + dig;
  800b20:	83 c1 01             	add    $0x1,%ecx
  800b23:	0f af 45 10          	imul   0x10(%ebp),%eax
  800b27:	01 d0                	add    %edx,%eax
		if (*s >= '0' && *s <= '9')
  800b29:	0f b6 11             	movzbl (%ecx),%edx
  800b2c:	8d 72 d0             	lea    -0x30(%edx),%esi
  800b2f:	89 f3                	mov    %esi,%ebx
  800b31:	80 fb 09             	cmp    $0x9,%bl
  800b34:	76 df                	jbe    800b15 <strtol+0x80>
		else if (*s >= 'a' && *s <= 'z')
  800b36:	8d 72 9f             	lea    -0x61(%edx),%esi
  800b39:	89 f3                	mov    %esi,%ebx
  800b3b:	80 fb 19             	cmp    $0x19,%bl
  800b3e:	77 08                	ja     800b48 <strtol+0xb3>
			dig = *s - 'a' + 10;
  800b40:	0f be d2             	movsbl %dl,%edx
  800b43:	83 ea 57             	sub    $0x57,%edx
  800b46:	eb d3                	jmp    800b1b <strtol+0x86>
		else if (*s >= 'A' && *s <= 'Z')
  800b48:	8d 72 bf             	lea    -0x41(%edx),%esi
  800b4b:	89 f3                	mov    %esi,%ebx
  800b4d:	80 fb 19             	cmp    $0x19,%bl
  800b50:	77 08                	ja     800b5a <strtol+0xc5>
			dig = *s - 'A' + 10;
  800b52:	0f be d2             	movsbl %dl,%edx
  800b55:	83 ea 37             	sub    $0x37,%edx
  800b58:	eb c1                	jmp    800b1b <strtol+0x86>
		// we don't properly detect overflow!
	}

	if (endptr)
  800b5a:	83 7d 0c 00          	cmpl   $0x0,0xc(%ebp)
  800b5e:	74 05                	je     800b65 <strtol+0xd0>
		*endptr = (char *) s;
  800b60:	8b 75 0c             	mov    0xc(%ebp),%esi
  800b63:	89 0e                	mov    %ecx,(%esi)
	return (neg ? -val : val);
  800b65:	89 c2                	mov    %eax,%edx
  800b67:	f7 da                	neg    %edx
  800b69:	85 ff                	test   %edi,%edi
  800b6b:	0f 45 c2             	cmovne %edx,%eax
}
  800b6e:	5b                   	pop    %ebx
  800b6f:	5e                   	pop    %esi
  800b70:	5f                   	pop    %edi
  800b71:	5d                   	pop    %ebp
  800b72:	c3                   	ret    

00800b73 <sys_cputs>:
	return ret;
}

void
sys_cputs(const char *s, size_t len)
{
  800b73:	f3 0f 1e fb          	endbr32 
  800b77:	55                   	push   %ebp
  800b78:	89 e5                	mov    %esp,%ebp
  800b7a:	57                   	push   %edi
  800b7b:	56                   	push   %esi
  800b7c:	53                   	push   %ebx
	asm volatile("int %1\n"
  800b7d:	b8 00 00 00 00       	mov    $0x0,%eax
  800b82:	8b 55 08             	mov    0x8(%ebp),%edx
  800b85:	8b 4d 0c             	mov    0xc(%ebp),%ecx
  800b88:	89 c3                	mov    %eax,%ebx
  800b8a:	89 c7                	mov    %eax,%edi
  800b8c:	89 c6                	mov    %eax,%esi
  800b8e:	cd 30                	int    $0x30
	syscall(SYS_cputs, 0, (uint32_t)s, len, 0, 0, 0);
}
  800b90:	5b                   	pop    %ebx
  800b91:	5e                   	pop    %esi
  800b92:	5f                   	pop    %edi
  800b93:	5d                   	pop    %ebp
  800b94:	c3                   	ret    

00800b95 <sys_cgetc>:

int
sys_cgetc(void)
{
  800b95:	f3 0f 1e fb          	endbr32 
  800b99:	55                   	push   %ebp
  800b9a:	89 e5                	mov    %esp,%ebp
  800b9c:	57                   	push   %edi
  800b9d:	56                   	push   %esi
  800b9e:	53                   	push   %ebx
	asm volatile("int %1\n"
  800b9f:	ba 00 00 00 00       	mov    $0x0,%edx
  800ba4:	b8 01 00 00 00       	mov    $0x1,%eax
  800ba9:	89 d1                	mov    %edx,%ecx
  800bab:	89 d3                	mov    %edx,%ebx
  800bad:	89 d7                	mov    %edx,%edi
  800baf:	89 d6                	mov    %edx,%esi
  800bb1:	cd 30                	int    $0x30
	return syscall(SYS_cgetc, 0, 0, 0, 0, 0, 0);
}
  800bb3:	5b                   	pop    %ebx
  800bb4:	5e                   	pop    %esi
  800bb5:	5f                   	pop    %edi
  800bb6:	5d                   	pop    %ebp
  800bb7:	c3                   	ret    

00800bb8 <sys_env_destroy>:

int
sys_env_destroy(envid_t envid)
{
  800bb8:	f3 0f 1e fb          	endbr32 
  800bbc:	55                   	push   %ebp
  800bbd:	89 e5                	mov    %esp,%ebp
  800bbf:	57                   	push   %edi
  800bc0:	56                   	push   %esi
  800bc1:	53                   	push   %ebx
  800bc2:	83 ec 0c             	sub    $0xc,%esp
	asm volatile("int %1\n"
  800bc5:	b9 00 00 00 00       	mov    $0x0,%ecx
  800bca:	8b 55 08             	mov    0x8(%ebp),%edx
  800bcd:	b8 03 00 00 00       	mov    $0x3,%eax
  800bd2:	89 cb                	mov    %ecx,%ebx
  800bd4:	89 cf                	mov    %ecx,%edi
  800bd6:	89 ce                	mov    %ecx,%esi
  800bd8:	cd 30                	int    $0x30
	if(check && ret > 0)
  800bda:	85 c0                	test   %eax,%eax
  800bdc:	7f 08                	jg     800be6 <sys_env_destroy+0x2e>
	return syscall(SYS_env_destroy, 1, envid, 0, 0, 0, 0);
}
  800bde:	8d 65 f4             	lea    -0xc(%ebp),%esp
  800be1:	5b                   	pop    %ebx
  800be2:	5e                   	pop    %esi
  800be3:	5f                   	pop    %edi
  800be4:	5d                   	pop    %ebp
  800be5:	c3                   	ret    
		panic("syscall %d returned %d (> 0)", num, ret);
  800be6:	83 ec 0c             	sub    $0xc,%esp
  800be9:	50                   	push   %eax
  800bea:	6a 03                	push   $0x3
  800bec:	68 5f 25 80 00       	push   $0x80255f
  800bf1:	6a 23                	push   $0x23
  800bf3:	68 7c 25 80 00       	push   $0x80257c
  800bf8:	e8 1f 12 00 00       	call   801e1c <_panic>

00800bfd <sys_getenvid>:

envid_t
sys_getenvid(void)
{
  800bfd:	f3 0f 1e fb          	endbr32 
  800c01:	55                   	push   %ebp
  800c02:	89 e5                	mov    %esp,%ebp
  800c04:	57                   	push   %edi
  800c05:	56                   	push   %esi
  800c06:	53                   	push   %ebx
	asm volatile("int %1\n"
  800c07:	ba 00 00 00 00       	mov    $0x0,%edx
  800c0c:	b8 02 00 00 00       	mov    $0x2,%eax
  800c11:	89 d1                	mov    %edx,%ecx
  800c13:	89 d3                	mov    %edx,%ebx
  800c15:	89 d7                	mov    %edx,%edi
  800c17:	89 d6                	mov    %edx,%esi
  800c19:	cd 30                	int    $0x30
	 return syscall(SYS_getenvid, 0, 0, 0, 0, 0, 0);
}
  800c1b:	5b                   	pop    %ebx
  800c1c:	5e                   	pop    %esi
  800c1d:	5f                   	pop    %edi
  800c1e:	5d                   	pop    %ebp
  800c1f:	c3                   	ret    

00800c20 <sys_yield>:

void
sys_yield(void)
{
  800c20:	f3 0f 1e fb          	endbr32 
  800c24:	55                   	push   %ebp
  800c25:	89 e5                	mov    %esp,%ebp
  800c27:	57                   	push   %edi
  800c28:	56                   	push   %esi
  800c29:	53                   	push   %ebx
	asm volatile("int %1\n"
  800c2a:	ba 00 00 00 00       	mov    $0x0,%edx
  800c2f:	b8 0b 00 00 00       	mov    $0xb,%eax
  800c34:	89 d1                	mov    %edx,%ecx
  800c36:	89 d3                	mov    %edx,%ebx
  800c38:	89 d7                	mov    %edx,%edi
  800c3a:	89 d6                	mov    %edx,%esi
  800c3c:	cd 30                	int    $0x30
	syscall(SYS_yield, 0, 0, 0, 0, 0, 0);
}
  800c3e:	5b                   	pop    %ebx
  800c3f:	5e                   	pop    %esi
  800c40:	5f                   	pop    %edi
  800c41:	5d                   	pop    %ebp
  800c42:	c3                   	ret    

00800c43 <sys_page_alloc>:

int
sys_page_alloc(envid_t envid, void *va, int perm)
{
  800c43:	f3 0f 1e fb          	endbr32 
  800c47:	55                   	push   %ebp
  800c48:	89 e5                	mov    %esp,%ebp
  800c4a:	57                   	push   %edi
  800c4b:	56                   	push   %esi
  800c4c:	53                   	push   %ebx
  800c4d:	83 ec 0c             	sub    $0xc,%esp
	asm volatile("int %1\n"
  800c50:	be 00 00 00 00       	mov    $0x0,%esi
  800c55:	8b 55 08             	mov    0x8(%ebp),%edx
  800c58:	8b 4d 0c             	mov    0xc(%ebp),%ecx
  800c5b:	b8 04 00 00 00       	mov    $0x4,%eax
  800c60:	8b 5d 10             	mov    0x10(%ebp),%ebx
  800c63:	89 f7                	mov    %esi,%edi
  800c65:	cd 30                	int    $0x30
	if(check && ret > 0)
  800c67:	85 c0                	test   %eax,%eax
  800c69:	7f 08                	jg     800c73 <sys_page_alloc+0x30>
	return syscall(SYS_page_alloc, 1, envid, (uint32_t) va, perm, 0, 0);
}
  800c6b:	8d 65 f4             	lea    -0xc(%ebp),%esp
  800c6e:	5b                   	pop    %ebx
  800c6f:	5e                   	pop    %esi
  800c70:	5f                   	pop    %edi
  800c71:	5d                   	pop    %ebp
  800c72:	c3                   	ret    
		panic("syscall %d returned %d (> 0)", num, ret);
  800c73:	83 ec 0c             	sub    $0xc,%esp
  800c76:	50                   	push   %eax
  800c77:	6a 04                	push   $0x4
  800c79:	68 5f 25 80 00       	push   $0x80255f
  800c7e:	6a 23                	push   $0x23
  800c80:	68 7c 25 80 00       	push   $0x80257c
  800c85:	e8 92 11 00 00       	call   801e1c <_panic>

00800c8a <sys_page_map>:

int
sys_page_map(envid_t srcenv, void *srcva, envid_t dstenv, void *dstva, int perm)
{
  800c8a:	f3 0f 1e fb          	endbr32 
  800c8e:	55                   	push   %ebp
  800c8f:	89 e5                	mov    %esp,%ebp
  800c91:	57                   	push   %edi
  800c92:	56                   	push   %esi
  800c93:	53                   	push   %ebx
  800c94:	83 ec 0c             	sub    $0xc,%esp
	asm volatile("int %1\n"
  800c97:	8b 55 08             	mov    0x8(%ebp),%edx
  800c9a:	8b 4d 0c             	mov    0xc(%ebp),%ecx
  800c9d:	b8 05 00 00 00       	mov    $0x5,%eax
  800ca2:	8b 5d 10             	mov    0x10(%ebp),%ebx
  800ca5:	8b 7d 14             	mov    0x14(%ebp),%edi
  800ca8:	8b 75 18             	mov    0x18(%ebp),%esi
  800cab:	cd 30                	int    $0x30
	if(check && ret > 0)
  800cad:	85 c0                	test   %eax,%eax
  800caf:	7f 08                	jg     800cb9 <sys_page_map+0x2f>
	return syscall(SYS_page_map, 1, srcenv, (uint32_t) srcva, dstenv, (uint32_t) dstva, perm);
}
  800cb1:	8d 65 f4             	lea    -0xc(%ebp),%esp
  800cb4:	5b                   	pop    %ebx
  800cb5:	5e                   	pop    %esi
  800cb6:	5f                   	pop    %edi
  800cb7:	5d                   	pop    %ebp
  800cb8:	c3                   	ret    
		panic("syscall %d returned %d (> 0)", num, ret);
  800cb9:	83 ec 0c             	sub    $0xc,%esp
  800cbc:	50                   	push   %eax
  800cbd:	6a 05                	push   $0x5
  800cbf:	68 5f 25 80 00       	push   $0x80255f
  800cc4:	6a 23                	push   $0x23
  800cc6:	68 7c 25 80 00       	push   $0x80257c
  800ccb:	e8 4c 11 00 00       	call   801e1c <_panic>

00800cd0 <sys_page_unmap>:

int
sys_page_unmap(envid_t envid, void *va)
{
  800cd0:	f3 0f 1e fb          	endbr32 
  800cd4:	55                   	push   %ebp
  800cd5:	89 e5                	mov    %esp,%ebp
  800cd7:	57                   	push   %edi
  800cd8:	56                   	push   %esi
  800cd9:	53                   	push   %ebx
  800cda:	83 ec 0c             	sub    $0xc,%esp
	asm volatile("int %1\n"
  800cdd:	bb 00 00 00 00       	mov    $0x0,%ebx
  800ce2:	8b 55 08             	mov    0x8(%ebp),%edx
  800ce5:	8b 4d 0c             	mov    0xc(%ebp),%ecx
  800ce8:	b8 06 00 00 00       	mov    $0x6,%eax
  800ced:	89 df                	mov    %ebx,%edi
  800cef:	89 de                	mov    %ebx,%esi
  800cf1:	cd 30                	int    $0x30
	if(check && ret > 0)
  800cf3:	85 c0                	test   %eax,%eax
  800cf5:	7f 08                	jg     800cff <sys_page_unmap+0x2f>
	return syscall(SYS_page_unmap, 1, envid, (uint32_t) va, 0, 0, 0);
}
  800cf7:	8d 65 f4             	lea    -0xc(%ebp),%esp
  800cfa:	5b                   	pop    %ebx
  800cfb:	5e                   	pop    %esi
  800cfc:	5f                   	pop    %edi
  800cfd:	5d                   	pop    %ebp
  800cfe:	c3                   	ret    
		panic("syscall %d returned %d (> 0)", num, ret);
  800cff:	83 ec 0c             	sub    $0xc,%esp
  800d02:	50                   	push   %eax
  800d03:	6a 06                	push   $0x6
  800d05:	68 5f 25 80 00       	push   $0x80255f
  800d0a:	6a 23                	push   $0x23
  800d0c:	68 7c 25 80 00       	push   $0x80257c
  800d11:	e8 06 11 00 00       	call   801e1c <_panic>

00800d16 <sys_env_set_status>:

// sys_exofork is inlined in lib.h

int
sys_env_set_status(envid_t envid, int status)
{
  800d16:	f3 0f 1e fb          	endbr32 
  800d1a:	55                   	push   %ebp
  800d1b:	89 e5                	mov    %esp,%ebp
  800d1d:	57                   	push   %edi
  800d1e:	56                   	push   %esi
  800d1f:	53                   	push   %ebx
  800d20:	83 ec 0c             	sub    $0xc,%esp
	asm volatile("int %1\n"
  800d23:	bb 00 00 00 00       	mov    $0x0,%ebx
  800d28:	8b 55 08             	mov    0x8(%ebp),%edx
  800d2b:	8b 4d 0c             	mov    0xc(%ebp),%ecx
  800d2e:	b8 08 00 00 00       	mov    $0x8,%eax
  800d33:	89 df                	mov    %ebx,%edi
  800d35:	89 de                	mov    %ebx,%esi
  800d37:	cd 30                	int    $0x30
	if(check && ret > 0)
  800d39:	85 c0                	test   %eax,%eax
  800d3b:	7f 08                	jg     800d45 <sys_env_set_status+0x2f>
	return syscall(SYS_env_set_status, 1, envid, status, 0, 0, 0);
}
  800d3d:	8d 65 f4             	lea    -0xc(%ebp),%esp
  800d40:	5b                   	pop    %ebx
  800d41:	5e                   	pop    %esi
  800d42:	5f                   	pop    %edi
  800d43:	5d                   	pop    %ebp
  800d44:	c3                   	ret    
		panic("syscall %d returned %d (> 0)", num, ret);
  800d45:	83 ec 0c             	sub    $0xc,%esp
  800d48:	50                   	push   %eax
  800d49:	6a 08                	push   $0x8
  800d4b:	68 5f 25 80 00       	push   $0x80255f
  800d50:	6a 23                	push   $0x23
  800d52:	68 7c 25 80 00       	push   $0x80257c
  800d57:	e8 c0 10 00 00       	call   801e1c <_panic>

00800d5c <sys_env_set_trapframe>:

int
sys_env_set_trapframe(envid_t envid, struct Trapframe *tf)
{
  800d5c:	f3 0f 1e fb          	endbr32 
  800d60:	55                   	push   %ebp
  800d61:	89 e5                	mov    %esp,%ebp
  800d63:	57                   	push   %edi
  800d64:	56                   	push   %esi
  800d65:	53                   	push   %ebx
  800d66:	83 ec 0c             	sub    $0xc,%esp
	asm volatile("int %1\n"
  800d69:	bb 00 00 00 00       	mov    $0x0,%ebx
  800d6e:	8b 55 08             	mov    0x8(%ebp),%edx
  800d71:	8b 4d 0c             	mov    0xc(%ebp),%ecx
  800d74:	b8 09 00 00 00       	mov    $0x9,%eax
  800d79:	89 df                	mov    %ebx,%edi
  800d7b:	89 de                	mov    %ebx,%esi
  800d7d:	cd 30                	int    $0x30
	if(check && ret > 0)
  800d7f:	85 c0                	test   %eax,%eax
  800d81:	7f 08                	jg     800d8b <sys_env_set_trapframe+0x2f>
	return syscall(SYS_env_set_trapframe, 1, envid, (uint32_t) tf, 0, 0, 0);
}
  800d83:	8d 65 f4             	lea    -0xc(%ebp),%esp
  800d86:	5b                   	pop    %ebx
  800d87:	5e                   	pop    %esi
  800d88:	5f                   	pop    %edi
  800d89:	5d                   	pop    %ebp
  800d8a:	c3                   	ret    
		panic("syscall %d returned %d (> 0)", num, ret);
  800d8b:	83 ec 0c             	sub    $0xc,%esp
  800d8e:	50                   	push   %eax
  800d8f:	6a 09                	push   $0x9
  800d91:	68 5f 25 80 00       	push   $0x80255f
  800d96:	6a 23                	push   $0x23
  800d98:	68 7c 25 80 00       	push   $0x80257c
  800d9d:	e8 7a 10 00 00       	call   801e1c <_panic>

00800da2 <sys_env_set_pgfault_upcall>:

int
sys_env_set_pgfault_upcall(envid_t envid, void *upcall)
{
  800da2:	f3 0f 1e fb          	endbr32 
  800da6:	55                   	push   %ebp
  800da7:	89 e5                	mov    %esp,%ebp
  800da9:	57                   	push   %edi
  800daa:	56                   	push   %esi
  800dab:	53                   	push   %ebx
  800dac:	83 ec 0c             	sub    $0xc,%esp
	asm volatile("int %1\n"
  800daf:	bb 00 00 00 00       	mov    $0x0,%ebx
  800db4:	8b 55 08             	mov    0x8(%ebp),%edx
  800db7:	8b 4d 0c             	mov    0xc(%ebp),%ecx
  800dba:	b8 0a 00 00 00       	mov    $0xa,%eax
  800dbf:	89 df                	mov    %ebx,%edi
  800dc1:	89 de                	mov    %ebx,%esi
  800dc3:	cd 30                	int    $0x30
	if(check && ret > 0)
  800dc5:	85 c0                	test   %eax,%eax
  800dc7:	7f 08                	jg     800dd1 <sys_env_set_pgfault_upcall+0x2f>
	return syscall(SYS_env_set_pgfault_upcall, 1, envid, (uint32_t) upcall, 0, 0, 0);
}
  800dc9:	8d 65 f4             	lea    -0xc(%ebp),%esp
  800dcc:	5b                   	pop    %ebx
  800dcd:	5e                   	pop    %esi
  800dce:	5f                   	pop    %edi
  800dcf:	5d                   	pop    %ebp
  800dd0:	c3                   	ret    
		panic("syscall %d returned %d (> 0)", num, ret);
  800dd1:	83 ec 0c             	sub    $0xc,%esp
  800dd4:	50                   	push   %eax
  800dd5:	6a 0a                	push   $0xa
  800dd7:	68 5f 25 80 00       	push   $0x80255f
  800ddc:	6a 23                	push   $0x23
  800dde:	68 7c 25 80 00       	push   $0x80257c
  800de3:	e8 34 10 00 00       	call   801e1c <_panic>

00800de8 <sys_ipc_try_send>:

int
sys_ipc_try_send(envid_t envid, uint32_t value, void *srcva, int perm)
{
  800de8:	f3 0f 1e fb          	endbr32 
  800dec:	55                   	push   %ebp
  800ded:	89 e5                	mov    %esp,%ebp
  800def:	57                   	push   %edi
  800df0:	56                   	push   %esi
  800df1:	53                   	push   %ebx
	asm volatile("int %1\n"
  800df2:	8b 55 08             	mov    0x8(%ebp),%edx
  800df5:	8b 4d 0c             	mov    0xc(%ebp),%ecx
  800df8:	b8 0c 00 00 00       	mov    $0xc,%eax
  800dfd:	be 00 00 00 00       	mov    $0x0,%esi
  800e02:	8b 5d 10             	mov    0x10(%ebp),%ebx
  800e05:	8b 7d 14             	mov    0x14(%ebp),%edi
  800e08:	cd 30                	int    $0x30
	return syscall(SYS_ipc_try_send, 0, envid, value, (uint32_t) srcva, perm, 0);
}
  800e0a:	5b                   	pop    %ebx
  800e0b:	5e                   	pop    %esi
  800e0c:	5f                   	pop    %edi
  800e0d:	5d                   	pop    %ebp
  800e0e:	c3                   	ret    

00800e0f <sys_ipc_recv>:

int
sys_ipc_recv(void *dstva)
{
  800e0f:	f3 0f 1e fb          	endbr32 
  800e13:	55                   	push   %ebp
  800e14:	89 e5                	mov    %esp,%ebp
  800e16:	57                   	push   %edi
  800e17:	56                   	push   %esi
  800e18:	53                   	push   %ebx
  800e19:	83 ec 0c             	sub    $0xc,%esp
	asm volatile("int %1\n"
  800e1c:	b9 00 00 00 00       	mov    $0x0,%ecx
  800e21:	8b 55 08             	mov    0x8(%ebp),%edx
  800e24:	b8 0d 00 00 00       	mov    $0xd,%eax
  800e29:	89 cb                	mov    %ecx,%ebx
  800e2b:	89 cf                	mov    %ecx,%edi
  800e2d:	89 ce                	mov    %ecx,%esi
  800e2f:	cd 30                	int    $0x30
	if(check && ret > 0)
  800e31:	85 c0                	test   %eax,%eax
  800e33:	7f 08                	jg     800e3d <sys_ipc_recv+0x2e>
	return syscall(SYS_ipc_recv, 1, (uint32_t)dstva, 0, 0, 0, 0);
}
  800e35:	8d 65 f4             	lea    -0xc(%ebp),%esp
  800e38:	5b                   	pop    %ebx
  800e39:	5e                   	pop    %esi
  800e3a:	5f                   	pop    %edi
  800e3b:	5d                   	pop    %ebp
  800e3c:	c3                   	ret    
		panic("syscall %d returned %d (> 0)", num, ret);
  800e3d:	83 ec 0c             	sub    $0xc,%esp
  800e40:	50                   	push   %eax
  800e41:	6a 0d                	push   $0xd
  800e43:	68 5f 25 80 00       	push   $0x80255f
  800e48:	6a 23                	push   $0x23
  800e4a:	68 7c 25 80 00       	push   $0x80257c
  800e4f:	e8 c8 0f 00 00       	call   801e1c <_panic>

00800e54 <argstart>:
#include <inc/args.h>
#include <inc/string.h>

void
argstart(int *argc, char **argv, struct Argstate *args)
{
  800e54:	f3 0f 1e fb          	endbr32 
  800e58:	55                   	push   %ebp
  800e59:	89 e5                	mov    %esp,%ebp
  800e5b:	8b 55 08             	mov    0x8(%ebp),%edx
  800e5e:	8b 4d 0c             	mov    0xc(%ebp),%ecx
  800e61:	8b 45 10             	mov    0x10(%ebp),%eax
	args->argc = argc;
  800e64:	89 10                	mov    %edx,(%eax)
	args->argv = (const char **) argv;
  800e66:	89 48 04             	mov    %ecx,0x4(%eax)
	args->curarg = (*argc > 1 && argv ? "" : 0);
  800e69:	83 3a 01             	cmpl   $0x1,(%edx)
  800e6c:	7e 09                	jle    800e77 <argstart+0x23>
  800e6e:	ba 31 22 80 00       	mov    $0x802231,%edx
  800e73:	85 c9                	test   %ecx,%ecx
  800e75:	75 05                	jne    800e7c <argstart+0x28>
  800e77:	ba 00 00 00 00       	mov    $0x0,%edx
  800e7c:	89 50 08             	mov    %edx,0x8(%eax)
	args->argvalue = 0;
  800e7f:	c7 40 0c 00 00 00 00 	movl   $0x0,0xc(%eax)
}
  800e86:	5d                   	pop    %ebp
  800e87:	c3                   	ret    

00800e88 <argnext>:

int
argnext(struct Argstate *args)
{
  800e88:	f3 0f 1e fb          	endbr32 
  800e8c:	55                   	push   %ebp
  800e8d:	89 e5                	mov    %esp,%ebp
  800e8f:	53                   	push   %ebx
  800e90:	83 ec 04             	sub    $0x4,%esp
  800e93:	8b 5d 08             	mov    0x8(%ebp),%ebx
	int arg;

	args->argvalue = 0;
  800e96:	c7 43 0c 00 00 00 00 	movl   $0x0,0xc(%ebx)

	// Done processing arguments if args->curarg == 0
	if (args->curarg == 0)
  800e9d:	8b 43 08             	mov    0x8(%ebx),%eax
  800ea0:	85 c0                	test   %eax,%eax
  800ea2:	74 74                	je     800f18 <argnext+0x90>
		return -1;

	if (!*args->curarg) {
  800ea4:	80 38 00             	cmpb   $0x0,(%eax)
  800ea7:	75 48                	jne    800ef1 <argnext+0x69>
		// Need to process the next argument
		// Check for end of argument list
		if (*args->argc == 1
  800ea9:	8b 0b                	mov    (%ebx),%ecx
  800eab:	83 39 01             	cmpl   $0x1,(%ecx)
  800eae:	74 5a                	je     800f0a <argnext+0x82>
		    || args->argv[1][0] != '-'
  800eb0:	8b 53 04             	mov    0x4(%ebx),%edx
  800eb3:	8b 42 04             	mov    0x4(%edx),%eax
  800eb6:	80 38 2d             	cmpb   $0x2d,(%eax)
  800eb9:	75 4f                	jne    800f0a <argnext+0x82>
		    || args->argv[1][1] == '\0')
  800ebb:	80 78 01 00          	cmpb   $0x0,0x1(%eax)
  800ebf:	74 49                	je     800f0a <argnext+0x82>
			goto endofargs;
		// Shift arguments down one
		args->curarg = args->argv[1] + 1;
  800ec1:	83 c0 01             	add    $0x1,%eax
  800ec4:	89 43 08             	mov    %eax,0x8(%ebx)
		memmove(args->argv + 1, args->argv + 2, sizeof(const char *) * (*args->argc - 1));
  800ec7:	83 ec 04             	sub    $0x4,%esp
  800eca:	8b 01                	mov    (%ecx),%eax
  800ecc:	8d 04 85 fc ff ff ff 	lea    -0x4(,%eax,4),%eax
  800ed3:	50                   	push   %eax
  800ed4:	8d 42 08             	lea    0x8(%edx),%eax
  800ed7:	50                   	push   %eax
  800ed8:	83 c2 04             	add    $0x4,%edx
  800edb:	52                   	push   %edx
  800edc:	e8 d6 fa ff ff       	call   8009b7 <memmove>
		(*args->argc)--;
  800ee1:	8b 03                	mov    (%ebx),%eax
  800ee3:	83 28 01             	subl   $0x1,(%eax)
		// Check for "--": end of argument list
		if (args->curarg[0] == '-' && args->curarg[1] == '\0')
  800ee6:	8b 43 08             	mov    0x8(%ebx),%eax
  800ee9:	83 c4 10             	add    $0x10,%esp
  800eec:	80 38 2d             	cmpb   $0x2d,(%eax)
  800eef:	74 13                	je     800f04 <argnext+0x7c>
			goto endofargs;
	}

	arg = (unsigned char) *args->curarg;
  800ef1:	8b 43 08             	mov    0x8(%ebx),%eax
  800ef4:	0f b6 10             	movzbl (%eax),%edx
	args->curarg++;
  800ef7:	83 c0 01             	add    $0x1,%eax
  800efa:	89 43 08             	mov    %eax,0x8(%ebx)
	return arg;

    endofargs:
	args->curarg = 0;
	return -1;
}
  800efd:	89 d0                	mov    %edx,%eax
  800eff:	8b 5d fc             	mov    -0x4(%ebp),%ebx
  800f02:	c9                   	leave  
  800f03:	c3                   	ret    
		if (args->curarg[0] == '-' && args->curarg[1] == '\0')
  800f04:	80 78 01 00          	cmpb   $0x0,0x1(%eax)
  800f08:	75 e7                	jne    800ef1 <argnext+0x69>
	args->curarg = 0;
  800f0a:	c7 43 08 00 00 00 00 	movl   $0x0,0x8(%ebx)
	return -1;
  800f11:	ba ff ff ff ff       	mov    $0xffffffff,%edx
  800f16:	eb e5                	jmp    800efd <argnext+0x75>
		return -1;
  800f18:	ba ff ff ff ff       	mov    $0xffffffff,%edx
  800f1d:	eb de                	jmp    800efd <argnext+0x75>

00800f1f <argnextvalue>:
	return (char*) (args->argvalue ? args->argvalue : argnextvalue(args));
}

char *
argnextvalue(struct Argstate *args)
{
  800f1f:	f3 0f 1e fb          	endbr32 
  800f23:	55                   	push   %ebp
  800f24:	89 e5                	mov    %esp,%ebp
  800f26:	53                   	push   %ebx
  800f27:	83 ec 04             	sub    $0x4,%esp
  800f2a:	8b 5d 08             	mov    0x8(%ebp),%ebx
	if (!args->curarg)
  800f2d:	8b 43 08             	mov    0x8(%ebx),%eax
  800f30:	85 c0                	test   %eax,%eax
  800f32:	74 12                	je     800f46 <argnextvalue+0x27>
		return 0;
	if (*args->curarg) {
  800f34:	80 38 00             	cmpb   $0x0,(%eax)
  800f37:	74 12                	je     800f4b <argnextvalue+0x2c>
		args->argvalue = args->curarg;
  800f39:	89 43 0c             	mov    %eax,0xc(%ebx)
		args->curarg = "";
  800f3c:	c7 43 08 31 22 80 00 	movl   $0x802231,0x8(%ebx)
		(*args->argc)--;
	} else {
		args->argvalue = 0;
		args->curarg = 0;
	}
	return (char*) args->argvalue;
  800f43:	8b 43 0c             	mov    0xc(%ebx),%eax
}
  800f46:	8b 5d fc             	mov    -0x4(%ebp),%ebx
  800f49:	c9                   	leave  
  800f4a:	c3                   	ret    
	} else if (*args->argc > 1) {
  800f4b:	8b 13                	mov    (%ebx),%edx
  800f4d:	83 3a 01             	cmpl   $0x1,(%edx)
  800f50:	7f 10                	jg     800f62 <argnextvalue+0x43>
		args->argvalue = 0;
  800f52:	c7 43 0c 00 00 00 00 	movl   $0x0,0xc(%ebx)
		args->curarg = 0;
  800f59:	c7 43 08 00 00 00 00 	movl   $0x0,0x8(%ebx)
  800f60:	eb e1                	jmp    800f43 <argnextvalue+0x24>
		args->argvalue = args->argv[1];
  800f62:	8b 43 04             	mov    0x4(%ebx),%eax
  800f65:	8b 48 04             	mov    0x4(%eax),%ecx
  800f68:	89 4b 0c             	mov    %ecx,0xc(%ebx)
		memmove(args->argv + 1, args->argv + 2, sizeof(const char *) * (*args->argc - 1));
  800f6b:	83 ec 04             	sub    $0x4,%esp
  800f6e:	8b 12                	mov    (%edx),%edx
  800f70:	8d 14 95 fc ff ff ff 	lea    -0x4(,%edx,4),%edx
  800f77:	52                   	push   %edx
  800f78:	8d 50 08             	lea    0x8(%eax),%edx
  800f7b:	52                   	push   %edx
  800f7c:	83 c0 04             	add    $0x4,%eax
  800f7f:	50                   	push   %eax
  800f80:	e8 32 fa ff ff       	call   8009b7 <memmove>
		(*args->argc)--;
  800f85:	8b 03                	mov    (%ebx),%eax
  800f87:	83 28 01             	subl   $0x1,(%eax)
  800f8a:	83 c4 10             	add    $0x10,%esp
  800f8d:	eb b4                	jmp    800f43 <argnextvalue+0x24>

00800f8f <argvalue>:
{
  800f8f:	f3 0f 1e fb          	endbr32 
  800f93:	55                   	push   %ebp
  800f94:	89 e5                	mov    %esp,%ebp
  800f96:	83 ec 08             	sub    $0x8,%esp
  800f99:	8b 55 08             	mov    0x8(%ebp),%edx
	return (char*) (args->argvalue ? args->argvalue : argnextvalue(args));
  800f9c:	8b 42 0c             	mov    0xc(%edx),%eax
  800f9f:	85 c0                	test   %eax,%eax
  800fa1:	74 02                	je     800fa5 <argvalue+0x16>
}
  800fa3:	c9                   	leave  
  800fa4:	c3                   	ret    
	return (char*) (args->argvalue ? args->argvalue : argnextvalue(args));
  800fa5:	83 ec 0c             	sub    $0xc,%esp
  800fa8:	52                   	push   %edx
  800fa9:	e8 71 ff ff ff       	call   800f1f <argnextvalue>
  800fae:	83 c4 10             	add    $0x10,%esp
  800fb1:	eb f0                	jmp    800fa3 <argvalue+0x14>

00800fb3 <fd2num>:
// File descriptor manipulators
// --------------------------------------------------------------

int
fd2num(struct Fd *fd)
{
  800fb3:	f3 0f 1e fb          	endbr32 
  800fb7:	55                   	push   %ebp
  800fb8:	89 e5                	mov    %esp,%ebp
	return ((uintptr_t) fd - FDTABLE) / PGSIZE;
  800fba:	8b 45 08             	mov    0x8(%ebp),%eax
  800fbd:	05 00 00 00 30       	add    $0x30000000,%eax
  800fc2:	c1 e8 0c             	shr    $0xc,%eax
}
  800fc5:	5d                   	pop    %ebp
  800fc6:	c3                   	ret    

00800fc7 <fd2data>:

char*
fd2data(struct Fd *fd)
{
  800fc7:	f3 0f 1e fb          	endbr32 
  800fcb:	55                   	push   %ebp
  800fcc:	89 e5                	mov    %esp,%ebp
	return ((uintptr_t) fd - FDTABLE) / PGSIZE;
  800fce:	8b 45 08             	mov    0x8(%ebp),%eax
  800fd1:	05 00 00 00 30       	add    $0x30000000,%eax
	return INDEX2DATA(fd2num(fd));
  800fd6:	25 00 f0 ff ff       	and    $0xfffff000,%eax
  800fdb:	2d 00 00 fe 2f       	sub    $0x2ffe0000,%eax
}
  800fe0:	5d                   	pop    %ebp
  800fe1:	c3                   	ret    

00800fe2 <fd_alloc>:
// Returns 0 on success, < 0 on error.  Errors are:
//	-E_MAX_FD: no more file descriptors
// On error, *fd_store is set to 0.
int
fd_alloc(struct Fd **fd_store)
{
  800fe2:	f3 0f 1e fb          	endbr32 
  800fe6:	55                   	push   %ebp
  800fe7:	89 e5                	mov    %esp,%ebp
  800fe9:	b8 00 00 00 d0       	mov    $0xd0000000,%eax
	int i;
	struct Fd *fd;

	for (i = 0; i < MAXFD; i++) {
		fd = INDEX2FD(i);
		if ((uvpd[PDX(fd)] & PTE_P) == 0 || (uvpt[PGNUM(fd)] & PTE_P) == 0) {
  800fee:	89 c2                	mov    %eax,%edx
  800ff0:	c1 ea 16             	shr    $0x16,%edx
  800ff3:	8b 14 95 00 d0 7b ef 	mov    -0x10843000(,%edx,4),%edx
  800ffa:	f6 c2 01             	test   $0x1,%dl
  800ffd:	74 2d                	je     80102c <fd_alloc+0x4a>
  800fff:	89 c2                	mov    %eax,%edx
  801001:	c1 ea 0c             	shr    $0xc,%edx
  801004:	8b 14 95 00 00 40 ef 	mov    -0x10c00000(,%edx,4),%edx
  80100b:	f6 c2 01             	test   $0x1,%dl
  80100e:	74 1c                	je     80102c <fd_alloc+0x4a>
  801010:	05 00 10 00 00       	add    $0x1000,%eax
	for (i = 0; i < MAXFD; i++) {
  801015:	3d 00 00 02 d0       	cmp    $0xd0020000,%eax
  80101a:	75 d2                	jne    800fee <fd_alloc+0xc>
			*fd_store = fd;
			return 0;
		}
	}
	*fd_store = 0;
  80101c:	8b 45 08             	mov    0x8(%ebp),%eax
  80101f:	c7 00 00 00 00 00    	movl   $0x0,(%eax)
	return -E_MAX_OPEN;
  801025:	b8 f6 ff ff ff       	mov    $0xfffffff6,%eax
  80102a:	eb 0a                	jmp    801036 <fd_alloc+0x54>
			*fd_store = fd;
  80102c:	8b 4d 08             	mov    0x8(%ebp),%ecx
  80102f:	89 01                	mov    %eax,(%ecx)
			return 0;
  801031:	b8 00 00 00 00       	mov    $0x0,%eax
}
  801036:	5d                   	pop    %ebp
  801037:	c3                   	ret    

00801038 <fd_lookup>:
// Returns 0 on success (the page is in range and mapped), < 0 on error.
// Errors are:
//	-E_INVAL: fdnum was either not in range or not mapped.
int
fd_lookup(int fdnum, struct Fd **fd_store)
{
  801038:	f3 0f 1e fb          	endbr32 
  80103c:	55                   	push   %ebp
  80103d:	89 e5                	mov    %esp,%ebp
  80103f:	8b 45 08             	mov    0x8(%ebp),%eax
	struct Fd *fd;

	if (fdnum < 0 || fdnum >= MAXFD) {
  801042:	83 f8 1f             	cmp    $0x1f,%eax
  801045:	77 30                	ja     801077 <fd_lookup+0x3f>
		if (debug)
			cprintf("[%08x] bad fd %d\n", thisenv->env_id, fdnum);
		return -E_INVAL;
	}
	fd = INDEX2FD(fdnum);
  801047:	c1 e0 0c             	shl    $0xc,%eax
  80104a:	2d 00 00 00 30       	sub    $0x30000000,%eax
	if (!(uvpd[PDX(fd)] & PTE_P) || !(uvpt[PGNUM(fd)] & PTE_P)) {
  80104f:	8b 15 00 dd 7b ef    	mov    0xef7bdd00,%edx
  801055:	f6 c2 01             	test   $0x1,%dl
  801058:	74 24                	je     80107e <fd_lookup+0x46>
  80105a:	89 c2                	mov    %eax,%edx
  80105c:	c1 ea 0c             	shr    $0xc,%edx
  80105f:	8b 14 95 00 00 40 ef 	mov    -0x10c00000(,%edx,4),%edx
  801066:	f6 c2 01             	test   $0x1,%dl
  801069:	74 1a                	je     801085 <fd_lookup+0x4d>
		if (debug)
			cprintf("[%08x] closed fd %d\n", thisenv->env_id, fdnum);
		return -E_INVAL;
	}
	*fd_store = fd;
  80106b:	8b 55 0c             	mov    0xc(%ebp),%edx
  80106e:	89 02                	mov    %eax,(%edx)
	return 0;
  801070:	b8 00 00 00 00       	mov    $0x0,%eax
}
  801075:	5d                   	pop    %ebp
  801076:	c3                   	ret    
		return -E_INVAL;
  801077:	b8 fd ff ff ff       	mov    $0xfffffffd,%eax
  80107c:	eb f7                	jmp    801075 <fd_lookup+0x3d>
		return -E_INVAL;
  80107e:	b8 fd ff ff ff       	mov    $0xfffffffd,%eax
  801083:	eb f0                	jmp    801075 <fd_lookup+0x3d>
  801085:	b8 fd ff ff ff       	mov    $0xfffffffd,%eax
  80108a:	eb e9                	jmp    801075 <fd_lookup+0x3d>

0080108c <dev_lookup>:
	0
};

int
dev_lookup(int dev_id, struct Dev **dev)
{
  80108c:	f3 0f 1e fb          	endbr32 
  801090:	55                   	push   %ebp
  801091:	89 e5                	mov    %esp,%ebp
  801093:	83 ec 08             	sub    $0x8,%esp
  801096:	8b 4d 08             	mov    0x8(%ebp),%ecx
  801099:	ba 08 26 80 00       	mov    $0x802608,%edx
	int i;
	for (i = 0; devtab[i]; i++)
  80109e:	b8 04 30 80 00       	mov    $0x803004,%eax
		if (devtab[i]->dev_id == dev_id) {
  8010a3:	39 08                	cmp    %ecx,(%eax)
  8010a5:	74 33                	je     8010da <dev_lookup+0x4e>
  8010a7:	83 c2 04             	add    $0x4,%edx
	for (i = 0; devtab[i]; i++)
  8010aa:	8b 02                	mov    (%edx),%eax
  8010ac:	85 c0                	test   %eax,%eax
  8010ae:	75 f3                	jne    8010a3 <dev_lookup+0x17>
			*dev = devtab[i];
			return 0;
		}
	cprintf("[%08x] unknown device type %d\n", thisenv->env_id, dev_id);
  8010b0:	a1 04 40 80 00       	mov    0x804004,%eax
  8010b5:	8b 40 48             	mov    0x48(%eax),%eax
  8010b8:	83 ec 04             	sub    $0x4,%esp
  8010bb:	51                   	push   %ecx
  8010bc:	50                   	push   %eax
  8010bd:	68 8c 25 80 00       	push   $0x80258c
  8010c2:	e8 61 f1 ff ff       	call   800228 <cprintf>
	*dev = 0;
  8010c7:	8b 45 0c             	mov    0xc(%ebp),%eax
  8010ca:	c7 00 00 00 00 00    	movl   $0x0,(%eax)
	return -E_INVAL;
  8010d0:	83 c4 10             	add    $0x10,%esp
  8010d3:	b8 fd ff ff ff       	mov    $0xfffffffd,%eax
}
  8010d8:	c9                   	leave  
  8010d9:	c3                   	ret    
			*dev = devtab[i];
  8010da:	8b 4d 0c             	mov    0xc(%ebp),%ecx
  8010dd:	89 01                	mov    %eax,(%ecx)
			return 0;
  8010df:	b8 00 00 00 00       	mov    $0x0,%eax
  8010e4:	eb f2                	jmp    8010d8 <dev_lookup+0x4c>

008010e6 <fd_close>:
{
  8010e6:	f3 0f 1e fb          	endbr32 
  8010ea:	55                   	push   %ebp
  8010eb:	89 e5                	mov    %esp,%ebp
  8010ed:	57                   	push   %edi
  8010ee:	56                   	push   %esi
  8010ef:	53                   	push   %ebx
  8010f0:	83 ec 24             	sub    $0x24,%esp
  8010f3:	8b 75 08             	mov    0x8(%ebp),%esi
  8010f6:	8b 7d 0c             	mov    0xc(%ebp),%edi
	if ((r = fd_lookup(fd2num(fd), &fd2)) < 0
  8010f9:	8d 45 e4             	lea    -0x1c(%ebp),%eax
  8010fc:	50                   	push   %eax
	return ((uintptr_t) fd - FDTABLE) / PGSIZE;
  8010fd:	8d 86 00 00 00 30    	lea    0x30000000(%esi),%eax
  801103:	c1 e8 0c             	shr    $0xc,%eax
	if ((r = fd_lookup(fd2num(fd), &fd2)) < 0
  801106:	50                   	push   %eax
  801107:	e8 2c ff ff ff       	call   801038 <fd_lookup>
  80110c:	89 c3                	mov    %eax,%ebx
  80110e:	83 c4 10             	add    $0x10,%esp
  801111:	85 c0                	test   %eax,%eax
  801113:	78 05                	js     80111a <fd_close+0x34>
	    || fd != fd2)
  801115:	39 75 e4             	cmp    %esi,-0x1c(%ebp)
  801118:	74 16                	je     801130 <fd_close+0x4a>
		return (must_exist ? r : 0);
  80111a:	89 f8                	mov    %edi,%eax
  80111c:	84 c0                	test   %al,%al
  80111e:	b8 00 00 00 00       	mov    $0x0,%eax
  801123:	0f 44 d8             	cmove  %eax,%ebx
}
  801126:	89 d8                	mov    %ebx,%eax
  801128:	8d 65 f4             	lea    -0xc(%ebp),%esp
  80112b:	5b                   	pop    %ebx
  80112c:	5e                   	pop    %esi
  80112d:	5f                   	pop    %edi
  80112e:	5d                   	pop    %ebp
  80112f:	c3                   	ret    
	if ((r = dev_lookup(fd->fd_dev_id, &dev)) >= 0) {
  801130:	83 ec 08             	sub    $0x8,%esp
  801133:	8d 45 e0             	lea    -0x20(%ebp),%eax
  801136:	50                   	push   %eax
  801137:	ff 36                	pushl  (%esi)
  801139:	e8 4e ff ff ff       	call   80108c <dev_lookup>
  80113e:	89 c3                	mov    %eax,%ebx
  801140:	83 c4 10             	add    $0x10,%esp
  801143:	85 c0                	test   %eax,%eax
  801145:	78 1a                	js     801161 <fd_close+0x7b>
		if (dev->dev_close)
  801147:	8b 45 e0             	mov    -0x20(%ebp),%eax
  80114a:	8b 40 10             	mov    0x10(%eax),%eax
			r = 0;
  80114d:	bb 00 00 00 00       	mov    $0x0,%ebx
		if (dev->dev_close)
  801152:	85 c0                	test   %eax,%eax
  801154:	74 0b                	je     801161 <fd_close+0x7b>
			r = (*dev->dev_close)(fd);
  801156:	83 ec 0c             	sub    $0xc,%esp
  801159:	56                   	push   %esi
  80115a:	ff d0                	call   *%eax
  80115c:	89 c3                	mov    %eax,%ebx
  80115e:	83 c4 10             	add    $0x10,%esp
	(void) sys_page_unmap(0, fd);
  801161:	83 ec 08             	sub    $0x8,%esp
  801164:	56                   	push   %esi
  801165:	6a 00                	push   $0x0
  801167:	e8 64 fb ff ff       	call   800cd0 <sys_page_unmap>
	return r;
  80116c:	83 c4 10             	add    $0x10,%esp
  80116f:	eb b5                	jmp    801126 <fd_close+0x40>

00801171 <close>:

int
close(int fdnum)
{
  801171:	f3 0f 1e fb          	endbr32 
  801175:	55                   	push   %ebp
  801176:	89 e5                	mov    %esp,%ebp
  801178:	83 ec 20             	sub    $0x20,%esp
	struct Fd *fd;
	int r;

	if ((r = fd_lookup(fdnum, &fd)) < 0)
  80117b:	8d 45 f4             	lea    -0xc(%ebp),%eax
  80117e:	50                   	push   %eax
  80117f:	ff 75 08             	pushl  0x8(%ebp)
  801182:	e8 b1 fe ff ff       	call   801038 <fd_lookup>
  801187:	83 c4 10             	add    $0x10,%esp
  80118a:	85 c0                	test   %eax,%eax
  80118c:	79 02                	jns    801190 <close+0x1f>
		return r;
	else
		return fd_close(fd, 1);
}
  80118e:	c9                   	leave  
  80118f:	c3                   	ret    
		return fd_close(fd, 1);
  801190:	83 ec 08             	sub    $0x8,%esp
  801193:	6a 01                	push   $0x1
  801195:	ff 75 f4             	pushl  -0xc(%ebp)
  801198:	e8 49 ff ff ff       	call   8010e6 <fd_close>
  80119d:	83 c4 10             	add    $0x10,%esp
  8011a0:	eb ec                	jmp    80118e <close+0x1d>

008011a2 <close_all>:

void
close_all(void)
{
  8011a2:	f3 0f 1e fb          	endbr32 
  8011a6:	55                   	push   %ebp
  8011a7:	89 e5                	mov    %esp,%ebp
  8011a9:	53                   	push   %ebx
  8011aa:	83 ec 04             	sub    $0x4,%esp
	int i;
	for (i = 0; i < MAXFD; i++)
  8011ad:	bb 00 00 00 00       	mov    $0x0,%ebx
		close(i);
  8011b2:	83 ec 0c             	sub    $0xc,%esp
  8011b5:	53                   	push   %ebx
  8011b6:	e8 b6 ff ff ff       	call   801171 <close>
	for (i = 0; i < MAXFD; i++)
  8011bb:	83 c3 01             	add    $0x1,%ebx
  8011be:	83 c4 10             	add    $0x10,%esp
  8011c1:	83 fb 20             	cmp    $0x20,%ebx
  8011c4:	75 ec                	jne    8011b2 <close_all+0x10>
}
  8011c6:	8b 5d fc             	mov    -0x4(%ebp),%ebx
  8011c9:	c9                   	leave  
  8011ca:	c3                   	ret    

008011cb <dup>:
// file and the file offset of the other.
// Closes any previously open file descriptor at 'newfdnum'.
// This is implemented using virtual memory tricks (of course!).
int
dup(int oldfdnum, int newfdnum)
{
  8011cb:	f3 0f 1e fb          	endbr32 
  8011cf:	55                   	push   %ebp
  8011d0:	89 e5                	mov    %esp,%ebp
  8011d2:	57                   	push   %edi
  8011d3:	56                   	push   %esi
  8011d4:	53                   	push   %ebx
  8011d5:	83 ec 24             	sub    $0x24,%esp
	int r;
	char *ova, *nva;
	pte_t pte;
	struct Fd *oldfd, *newfd;

	if ((r = fd_lookup(oldfdnum, &oldfd)) < 0)
  8011d8:	8d 45 e4             	lea    -0x1c(%ebp),%eax
  8011db:	50                   	push   %eax
  8011dc:	ff 75 08             	pushl  0x8(%ebp)
  8011df:	e8 54 fe ff ff       	call   801038 <fd_lookup>
  8011e4:	89 c3                	mov    %eax,%ebx
  8011e6:	83 c4 10             	add    $0x10,%esp
  8011e9:	85 c0                	test   %eax,%eax
  8011eb:	0f 88 81 00 00 00    	js     801272 <dup+0xa7>
		return r;
	close(newfdnum);
  8011f1:	83 ec 0c             	sub    $0xc,%esp
  8011f4:	ff 75 0c             	pushl  0xc(%ebp)
  8011f7:	e8 75 ff ff ff       	call   801171 <close>

	newfd = INDEX2FD(newfdnum);
  8011fc:	8b 75 0c             	mov    0xc(%ebp),%esi
  8011ff:	c1 e6 0c             	shl    $0xc,%esi
  801202:	81 ee 00 00 00 30    	sub    $0x30000000,%esi
	ova = fd2data(oldfd);
  801208:	83 c4 04             	add    $0x4,%esp
  80120b:	ff 75 e4             	pushl  -0x1c(%ebp)
  80120e:	e8 b4 fd ff ff       	call   800fc7 <fd2data>
  801213:	89 c3                	mov    %eax,%ebx
	nva = fd2data(newfd);
  801215:	89 34 24             	mov    %esi,(%esp)
  801218:	e8 aa fd ff ff       	call   800fc7 <fd2data>
  80121d:	83 c4 10             	add    $0x10,%esp
  801220:	89 c7                	mov    %eax,%edi

	if ((uvpd[PDX(ova)] & PTE_P) && (uvpt[PGNUM(ova)] & PTE_P))
  801222:	89 d8                	mov    %ebx,%eax
  801224:	c1 e8 16             	shr    $0x16,%eax
  801227:	8b 04 85 00 d0 7b ef 	mov    -0x10843000(,%eax,4),%eax
  80122e:	a8 01                	test   $0x1,%al
  801230:	74 11                	je     801243 <dup+0x78>
  801232:	89 d8                	mov    %ebx,%eax
  801234:	c1 e8 0c             	shr    $0xc,%eax
  801237:	8b 14 85 00 00 40 ef 	mov    -0x10c00000(,%eax,4),%edx
  80123e:	f6 c2 01             	test   $0x1,%dl
  801241:	75 39                	jne    80127c <dup+0xb1>
		if ((r = sys_page_map(0, ova, 0, nva, uvpt[PGNUM(ova)] & PTE_SYSCALL)) < 0)
			goto err;
	if ((r = sys_page_map(0, oldfd, 0, newfd, uvpt[PGNUM(oldfd)] & PTE_SYSCALL)) < 0)
  801243:	8b 55 e4             	mov    -0x1c(%ebp),%edx
  801246:	89 d0                	mov    %edx,%eax
  801248:	c1 e8 0c             	shr    $0xc,%eax
  80124b:	8b 04 85 00 00 40 ef 	mov    -0x10c00000(,%eax,4),%eax
  801252:	83 ec 0c             	sub    $0xc,%esp
  801255:	25 07 0e 00 00       	and    $0xe07,%eax
  80125a:	50                   	push   %eax
  80125b:	56                   	push   %esi
  80125c:	6a 00                	push   $0x0
  80125e:	52                   	push   %edx
  80125f:	6a 00                	push   $0x0
  801261:	e8 24 fa ff ff       	call   800c8a <sys_page_map>
  801266:	89 c3                	mov    %eax,%ebx
  801268:	83 c4 20             	add    $0x20,%esp
  80126b:	85 c0                	test   %eax,%eax
  80126d:	78 31                	js     8012a0 <dup+0xd5>
		goto err;

	return newfdnum;
  80126f:	8b 5d 0c             	mov    0xc(%ebp),%ebx

err:
	sys_page_unmap(0, newfd);
	sys_page_unmap(0, nva);
	return r;
}
  801272:	89 d8                	mov    %ebx,%eax
  801274:	8d 65 f4             	lea    -0xc(%ebp),%esp
  801277:	5b                   	pop    %ebx
  801278:	5e                   	pop    %esi
  801279:	5f                   	pop    %edi
  80127a:	5d                   	pop    %ebp
  80127b:	c3                   	ret    
		if ((r = sys_page_map(0, ova, 0, nva, uvpt[PGNUM(ova)] & PTE_SYSCALL)) < 0)
  80127c:	8b 04 85 00 00 40 ef 	mov    -0x10c00000(,%eax,4),%eax
  801283:	83 ec 0c             	sub    $0xc,%esp
  801286:	25 07 0e 00 00       	and    $0xe07,%eax
  80128b:	50                   	push   %eax
  80128c:	57                   	push   %edi
  80128d:	6a 00                	push   $0x0
  80128f:	53                   	push   %ebx
  801290:	6a 00                	push   $0x0
  801292:	e8 f3 f9 ff ff       	call   800c8a <sys_page_map>
  801297:	89 c3                	mov    %eax,%ebx
  801299:	83 c4 20             	add    $0x20,%esp
  80129c:	85 c0                	test   %eax,%eax
  80129e:	79 a3                	jns    801243 <dup+0x78>
	sys_page_unmap(0, newfd);
  8012a0:	83 ec 08             	sub    $0x8,%esp
  8012a3:	56                   	push   %esi
  8012a4:	6a 00                	push   $0x0
  8012a6:	e8 25 fa ff ff       	call   800cd0 <sys_page_unmap>
	sys_page_unmap(0, nva);
  8012ab:	83 c4 08             	add    $0x8,%esp
  8012ae:	57                   	push   %edi
  8012af:	6a 00                	push   $0x0
  8012b1:	e8 1a fa ff ff       	call   800cd0 <sys_page_unmap>
	return r;
  8012b6:	83 c4 10             	add    $0x10,%esp
  8012b9:	eb b7                	jmp    801272 <dup+0xa7>

008012bb <read>:

ssize_t
read(int fdnum, void *buf, size_t n)
{
  8012bb:	f3 0f 1e fb          	endbr32 
  8012bf:	55                   	push   %ebp
  8012c0:	89 e5                	mov    %esp,%ebp
  8012c2:	53                   	push   %ebx
  8012c3:	83 ec 1c             	sub    $0x1c,%esp
  8012c6:	8b 5d 08             	mov    0x8(%ebp),%ebx
	int r;
	struct Dev *dev;
	struct Fd *fd;

	if ((r = fd_lookup(fdnum, &fd)) < 0
  8012c9:	8d 45 f0             	lea    -0x10(%ebp),%eax
  8012cc:	50                   	push   %eax
  8012cd:	53                   	push   %ebx
  8012ce:	e8 65 fd ff ff       	call   801038 <fd_lookup>
  8012d3:	83 c4 10             	add    $0x10,%esp
  8012d6:	85 c0                	test   %eax,%eax
  8012d8:	78 3f                	js     801319 <read+0x5e>
	    || (r = dev_lookup(fd->fd_dev_id, &dev)) < 0)
  8012da:	83 ec 08             	sub    $0x8,%esp
  8012dd:	8d 45 f4             	lea    -0xc(%ebp),%eax
  8012e0:	50                   	push   %eax
  8012e1:	8b 45 f0             	mov    -0x10(%ebp),%eax
  8012e4:	ff 30                	pushl  (%eax)
  8012e6:	e8 a1 fd ff ff       	call   80108c <dev_lookup>
  8012eb:	83 c4 10             	add    $0x10,%esp
  8012ee:	85 c0                	test   %eax,%eax
  8012f0:	78 27                	js     801319 <read+0x5e>
		return r;
	if ((fd->fd_omode & O_ACCMODE) == O_WRONLY) {
  8012f2:	8b 55 f0             	mov    -0x10(%ebp),%edx
  8012f5:	8b 42 08             	mov    0x8(%edx),%eax
  8012f8:	83 e0 03             	and    $0x3,%eax
  8012fb:	83 f8 01             	cmp    $0x1,%eax
  8012fe:	74 1e                	je     80131e <read+0x63>
		cprintf("[%08x] read %d -- bad mode\n", thisenv->env_id, fdnum);
		return -E_INVAL;
	}
	if (!dev->dev_read)
  801300:	8b 45 f4             	mov    -0xc(%ebp),%eax
  801303:	8b 40 08             	mov    0x8(%eax),%eax
  801306:	85 c0                	test   %eax,%eax
  801308:	74 35                	je     80133f <read+0x84>
		return -E_NOT_SUPP;
	return (*dev->dev_read)(fd, buf, n);
  80130a:	83 ec 04             	sub    $0x4,%esp
  80130d:	ff 75 10             	pushl  0x10(%ebp)
  801310:	ff 75 0c             	pushl  0xc(%ebp)
  801313:	52                   	push   %edx
  801314:	ff d0                	call   *%eax
  801316:	83 c4 10             	add    $0x10,%esp
}
  801319:	8b 5d fc             	mov    -0x4(%ebp),%ebx
  80131c:	c9                   	leave  
  80131d:	c3                   	ret    
		cprintf("[%08x] read %d -- bad mode\n", thisenv->env_id, fdnum);
  80131e:	a1 04 40 80 00       	mov    0x804004,%eax
  801323:	8b 40 48             	mov    0x48(%eax),%eax
  801326:	83 ec 04             	sub    $0x4,%esp
  801329:	53                   	push   %ebx
  80132a:	50                   	push   %eax
  80132b:	68 cd 25 80 00       	push   $0x8025cd
  801330:	e8 f3 ee ff ff       	call   800228 <cprintf>
		return -E_INVAL;
  801335:	83 c4 10             	add    $0x10,%esp
  801338:	b8 fd ff ff ff       	mov    $0xfffffffd,%eax
  80133d:	eb da                	jmp    801319 <read+0x5e>
		return -E_NOT_SUPP;
  80133f:	b8 f1 ff ff ff       	mov    $0xfffffff1,%eax
  801344:	eb d3                	jmp    801319 <read+0x5e>

00801346 <readn>:

ssize_t
readn(int fdnum, void *buf, size_t n)
{
  801346:	f3 0f 1e fb          	endbr32 
  80134a:	55                   	push   %ebp
  80134b:	89 e5                	mov    %esp,%ebp
  80134d:	57                   	push   %edi
  80134e:	56                   	push   %esi
  80134f:	53                   	push   %ebx
  801350:	83 ec 0c             	sub    $0xc,%esp
  801353:	8b 7d 08             	mov    0x8(%ebp),%edi
  801356:	8b 75 10             	mov    0x10(%ebp),%esi
	int m, tot;

	for (tot = 0; tot < n; tot += m) {
  801359:	bb 00 00 00 00       	mov    $0x0,%ebx
  80135e:	eb 02                	jmp    801362 <readn+0x1c>
  801360:	01 c3                	add    %eax,%ebx
  801362:	39 f3                	cmp    %esi,%ebx
  801364:	73 21                	jae    801387 <readn+0x41>
		m = read(fdnum, (char*)buf + tot, n - tot);
  801366:	83 ec 04             	sub    $0x4,%esp
  801369:	89 f0                	mov    %esi,%eax
  80136b:	29 d8                	sub    %ebx,%eax
  80136d:	50                   	push   %eax
  80136e:	89 d8                	mov    %ebx,%eax
  801370:	03 45 0c             	add    0xc(%ebp),%eax
  801373:	50                   	push   %eax
  801374:	57                   	push   %edi
  801375:	e8 41 ff ff ff       	call   8012bb <read>
		if (m < 0)
  80137a:	83 c4 10             	add    $0x10,%esp
  80137d:	85 c0                	test   %eax,%eax
  80137f:	78 04                	js     801385 <readn+0x3f>
			return m;
		if (m == 0)
  801381:	75 dd                	jne    801360 <readn+0x1a>
  801383:	eb 02                	jmp    801387 <readn+0x41>
		m = read(fdnum, (char*)buf + tot, n - tot);
  801385:	89 c3                	mov    %eax,%ebx
			break;
	}
	return tot;
}
  801387:	89 d8                	mov    %ebx,%eax
  801389:	8d 65 f4             	lea    -0xc(%ebp),%esp
  80138c:	5b                   	pop    %ebx
  80138d:	5e                   	pop    %esi
  80138e:	5f                   	pop    %edi
  80138f:	5d                   	pop    %ebp
  801390:	c3                   	ret    

00801391 <write>:

ssize_t
write(int fdnum, const void *buf, size_t n)
{
  801391:	f3 0f 1e fb          	endbr32 
  801395:	55                   	push   %ebp
  801396:	89 e5                	mov    %esp,%ebp
  801398:	53                   	push   %ebx
  801399:	83 ec 1c             	sub    $0x1c,%esp
  80139c:	8b 5d 08             	mov    0x8(%ebp),%ebx
	int r;
	struct Dev *dev;
	struct Fd *fd;

	if ((r = fd_lookup(fdnum, &fd)) < 0
  80139f:	8d 45 f0             	lea    -0x10(%ebp),%eax
  8013a2:	50                   	push   %eax
  8013a3:	53                   	push   %ebx
  8013a4:	e8 8f fc ff ff       	call   801038 <fd_lookup>
  8013a9:	83 c4 10             	add    $0x10,%esp
  8013ac:	85 c0                	test   %eax,%eax
  8013ae:	78 3a                	js     8013ea <write+0x59>
	    || (r = dev_lookup(fd->fd_dev_id, &dev)) < 0)
  8013b0:	83 ec 08             	sub    $0x8,%esp
  8013b3:	8d 45 f4             	lea    -0xc(%ebp),%eax
  8013b6:	50                   	push   %eax
  8013b7:	8b 45 f0             	mov    -0x10(%ebp),%eax
  8013ba:	ff 30                	pushl  (%eax)
  8013bc:	e8 cb fc ff ff       	call   80108c <dev_lookup>
  8013c1:	83 c4 10             	add    $0x10,%esp
  8013c4:	85 c0                	test   %eax,%eax
  8013c6:	78 22                	js     8013ea <write+0x59>
		return r;
	if ((fd->fd_omode & O_ACCMODE) == O_RDONLY) {
  8013c8:	8b 45 f0             	mov    -0x10(%ebp),%eax
  8013cb:	f6 40 08 03          	testb  $0x3,0x8(%eax)
  8013cf:	74 1e                	je     8013ef <write+0x5e>
		return -E_INVAL;
	}
	if (debug)
		cprintf("write %d %p %d via dev %s\n",
			fdnum, buf, n, dev->dev_name);
	if (!dev->dev_write)
  8013d1:	8b 55 f4             	mov    -0xc(%ebp),%edx
  8013d4:	8b 52 0c             	mov    0xc(%edx),%edx
  8013d7:	85 d2                	test   %edx,%edx
  8013d9:	74 35                	je     801410 <write+0x7f>
		return -E_NOT_SUPP;
	return (*dev->dev_write)(fd, buf, n);
  8013db:	83 ec 04             	sub    $0x4,%esp
  8013de:	ff 75 10             	pushl  0x10(%ebp)
  8013e1:	ff 75 0c             	pushl  0xc(%ebp)
  8013e4:	50                   	push   %eax
  8013e5:	ff d2                	call   *%edx
  8013e7:	83 c4 10             	add    $0x10,%esp
}
  8013ea:	8b 5d fc             	mov    -0x4(%ebp),%ebx
  8013ed:	c9                   	leave  
  8013ee:	c3                   	ret    
		cprintf("[%08x] write %d -- bad mode\n", thisenv->env_id, fdnum);
  8013ef:	a1 04 40 80 00       	mov    0x804004,%eax
  8013f4:	8b 40 48             	mov    0x48(%eax),%eax
  8013f7:	83 ec 04             	sub    $0x4,%esp
  8013fa:	53                   	push   %ebx
  8013fb:	50                   	push   %eax
  8013fc:	68 e9 25 80 00       	push   $0x8025e9
  801401:	e8 22 ee ff ff       	call   800228 <cprintf>
		return -E_INVAL;
  801406:	83 c4 10             	add    $0x10,%esp
  801409:	b8 fd ff ff ff       	mov    $0xfffffffd,%eax
  80140e:	eb da                	jmp    8013ea <write+0x59>
		return -E_NOT_SUPP;
  801410:	b8 f1 ff ff ff       	mov    $0xfffffff1,%eax
  801415:	eb d3                	jmp    8013ea <write+0x59>

00801417 <seek>:

int
seek(int fdnum, off_t offset)
{
  801417:	f3 0f 1e fb          	endbr32 
  80141b:	55                   	push   %ebp
  80141c:	89 e5                	mov    %esp,%ebp
  80141e:	83 ec 20             	sub    $0x20,%esp
	int r;
	struct Fd *fd;

	if ((r = fd_lookup(fdnum, &fd)) < 0)
  801421:	8d 45 f4             	lea    -0xc(%ebp),%eax
  801424:	50                   	push   %eax
  801425:	ff 75 08             	pushl  0x8(%ebp)
  801428:	e8 0b fc ff ff       	call   801038 <fd_lookup>
  80142d:	83 c4 10             	add    $0x10,%esp
  801430:	85 c0                	test   %eax,%eax
  801432:	78 0e                	js     801442 <seek+0x2b>
		return r;
	fd->fd_offset = offset;
  801434:	8b 55 0c             	mov    0xc(%ebp),%edx
  801437:	8b 45 f4             	mov    -0xc(%ebp),%eax
  80143a:	89 50 04             	mov    %edx,0x4(%eax)
	return 0;
  80143d:	b8 00 00 00 00       	mov    $0x0,%eax
}
  801442:	c9                   	leave  
  801443:	c3                   	ret    

00801444 <ftruncate>:

int
ftruncate(int fdnum, off_t newsize)
{
  801444:	f3 0f 1e fb          	endbr32 
  801448:	55                   	push   %ebp
  801449:	89 e5                	mov    %esp,%ebp
  80144b:	53                   	push   %ebx
  80144c:	83 ec 1c             	sub    $0x1c,%esp
  80144f:	8b 5d 08             	mov    0x8(%ebp),%ebx
	int r;
	struct Dev *dev;
	struct Fd *fd;
	if ((r = fd_lookup(fdnum, &fd)) < 0
  801452:	8d 45 f0             	lea    -0x10(%ebp),%eax
  801455:	50                   	push   %eax
  801456:	53                   	push   %ebx
  801457:	e8 dc fb ff ff       	call   801038 <fd_lookup>
  80145c:	83 c4 10             	add    $0x10,%esp
  80145f:	85 c0                	test   %eax,%eax
  801461:	78 37                	js     80149a <ftruncate+0x56>
	    || (r = dev_lookup(fd->fd_dev_id, &dev)) < 0)
  801463:	83 ec 08             	sub    $0x8,%esp
  801466:	8d 45 f4             	lea    -0xc(%ebp),%eax
  801469:	50                   	push   %eax
  80146a:	8b 45 f0             	mov    -0x10(%ebp),%eax
  80146d:	ff 30                	pushl  (%eax)
  80146f:	e8 18 fc ff ff       	call   80108c <dev_lookup>
  801474:	83 c4 10             	add    $0x10,%esp
  801477:	85 c0                	test   %eax,%eax
  801479:	78 1f                	js     80149a <ftruncate+0x56>
		return r;
	if ((fd->fd_omode & O_ACCMODE) == O_RDONLY) {
  80147b:	8b 45 f0             	mov    -0x10(%ebp),%eax
  80147e:	f6 40 08 03          	testb  $0x3,0x8(%eax)
  801482:	74 1b                	je     80149f <ftruncate+0x5b>
		cprintf("[%08x] ftruncate %d -- bad mode\n",
			thisenv->env_id, fdnum);
		return -E_INVAL;
	}
	if (!dev->dev_trunc)
  801484:	8b 55 f4             	mov    -0xc(%ebp),%edx
  801487:	8b 52 18             	mov    0x18(%edx),%edx
  80148a:	85 d2                	test   %edx,%edx
  80148c:	74 32                	je     8014c0 <ftruncate+0x7c>
		return -E_NOT_SUPP;
	return (*dev->dev_trunc)(fd, newsize);
  80148e:	83 ec 08             	sub    $0x8,%esp
  801491:	ff 75 0c             	pushl  0xc(%ebp)
  801494:	50                   	push   %eax
  801495:	ff d2                	call   *%edx
  801497:	83 c4 10             	add    $0x10,%esp
}
  80149a:	8b 5d fc             	mov    -0x4(%ebp),%ebx
  80149d:	c9                   	leave  
  80149e:	c3                   	ret    
			thisenv->env_id, fdnum);
  80149f:	a1 04 40 80 00       	mov    0x804004,%eax
		cprintf("[%08x] ftruncate %d -- bad mode\n",
  8014a4:	8b 40 48             	mov    0x48(%eax),%eax
  8014a7:	83 ec 04             	sub    $0x4,%esp
  8014aa:	53                   	push   %ebx
  8014ab:	50                   	push   %eax
  8014ac:	68 ac 25 80 00       	push   $0x8025ac
  8014b1:	e8 72 ed ff ff       	call   800228 <cprintf>
		return -E_INVAL;
  8014b6:	83 c4 10             	add    $0x10,%esp
  8014b9:	b8 fd ff ff ff       	mov    $0xfffffffd,%eax
  8014be:	eb da                	jmp    80149a <ftruncate+0x56>
		return -E_NOT_SUPP;
  8014c0:	b8 f1 ff ff ff       	mov    $0xfffffff1,%eax
  8014c5:	eb d3                	jmp    80149a <ftruncate+0x56>

008014c7 <fstat>:

int
fstat(int fdnum, struct Stat *stat)
{
  8014c7:	f3 0f 1e fb          	endbr32 
  8014cb:	55                   	push   %ebp
  8014cc:	89 e5                	mov    %esp,%ebp
  8014ce:	53                   	push   %ebx
  8014cf:	83 ec 1c             	sub    $0x1c,%esp
  8014d2:	8b 5d 0c             	mov    0xc(%ebp),%ebx
	int r;
	struct Dev *dev;
	struct Fd *fd;

	if ((r = fd_lookup(fdnum, &fd)) < 0
  8014d5:	8d 45 f0             	lea    -0x10(%ebp),%eax
  8014d8:	50                   	push   %eax
  8014d9:	ff 75 08             	pushl  0x8(%ebp)
  8014dc:	e8 57 fb ff ff       	call   801038 <fd_lookup>
  8014e1:	83 c4 10             	add    $0x10,%esp
  8014e4:	85 c0                	test   %eax,%eax
  8014e6:	78 4b                	js     801533 <fstat+0x6c>
	    || (r = dev_lookup(fd->fd_dev_id, &dev)) < 0)
  8014e8:	83 ec 08             	sub    $0x8,%esp
  8014eb:	8d 45 f4             	lea    -0xc(%ebp),%eax
  8014ee:	50                   	push   %eax
  8014ef:	8b 45 f0             	mov    -0x10(%ebp),%eax
  8014f2:	ff 30                	pushl  (%eax)
  8014f4:	e8 93 fb ff ff       	call   80108c <dev_lookup>
  8014f9:	83 c4 10             	add    $0x10,%esp
  8014fc:	85 c0                	test   %eax,%eax
  8014fe:	78 33                	js     801533 <fstat+0x6c>
		return r;
	if (!dev->dev_stat)
  801500:	8b 45 f4             	mov    -0xc(%ebp),%eax
  801503:	83 78 14 00          	cmpl   $0x0,0x14(%eax)
  801507:	74 2f                	je     801538 <fstat+0x71>
		return -E_NOT_SUPP;
	stat->st_name[0] = 0;
  801509:	c6 03 00             	movb   $0x0,(%ebx)
	stat->st_size = 0;
  80150c:	c7 83 80 00 00 00 00 	movl   $0x0,0x80(%ebx)
  801513:	00 00 00 
	stat->st_isdir = 0;
  801516:	c7 83 84 00 00 00 00 	movl   $0x0,0x84(%ebx)
  80151d:	00 00 00 
	stat->st_dev = dev;
  801520:	89 83 88 00 00 00    	mov    %eax,0x88(%ebx)
	return (*dev->dev_stat)(fd, stat);
  801526:	83 ec 08             	sub    $0x8,%esp
  801529:	53                   	push   %ebx
  80152a:	ff 75 f0             	pushl  -0x10(%ebp)
  80152d:	ff 50 14             	call   *0x14(%eax)
  801530:	83 c4 10             	add    $0x10,%esp
}
  801533:	8b 5d fc             	mov    -0x4(%ebp),%ebx
  801536:	c9                   	leave  
  801537:	c3                   	ret    
		return -E_NOT_SUPP;
  801538:	b8 f1 ff ff ff       	mov    $0xfffffff1,%eax
  80153d:	eb f4                	jmp    801533 <fstat+0x6c>

0080153f <stat>:

int
stat(const char *path, struct Stat *stat)
{
  80153f:	f3 0f 1e fb          	endbr32 
  801543:	55                   	push   %ebp
  801544:	89 e5                	mov    %esp,%ebp
  801546:	56                   	push   %esi
  801547:	53                   	push   %ebx
	int fd, r;

	if ((fd = open(path, O_RDONLY)) < 0)
  801548:	83 ec 08             	sub    $0x8,%esp
  80154b:	6a 00                	push   $0x0
  80154d:	ff 75 08             	pushl  0x8(%ebp)
  801550:	e8 fb 01 00 00       	call   801750 <open>
  801555:	89 c3                	mov    %eax,%ebx
  801557:	83 c4 10             	add    $0x10,%esp
  80155a:	85 c0                	test   %eax,%eax
  80155c:	78 1b                	js     801579 <stat+0x3a>
		return fd;
	r = fstat(fd, stat);
  80155e:	83 ec 08             	sub    $0x8,%esp
  801561:	ff 75 0c             	pushl  0xc(%ebp)
  801564:	50                   	push   %eax
  801565:	e8 5d ff ff ff       	call   8014c7 <fstat>
  80156a:	89 c6                	mov    %eax,%esi
	close(fd);
  80156c:	89 1c 24             	mov    %ebx,(%esp)
  80156f:	e8 fd fb ff ff       	call   801171 <close>
	return r;
  801574:	83 c4 10             	add    $0x10,%esp
  801577:	89 f3                	mov    %esi,%ebx
}
  801579:	89 d8                	mov    %ebx,%eax
  80157b:	8d 65 f8             	lea    -0x8(%ebp),%esp
  80157e:	5b                   	pop    %ebx
  80157f:	5e                   	pop    %esi
  801580:	5d                   	pop    %ebp
  801581:	c3                   	ret    

00801582 <fsipc>:
// type: request code, passed as the simple integer IPC value.
// dstva: virtual address at which to receive reply page, 0 if none.
// Returns result from the file server.
static int
fsipc(unsigned type, void *dstva)
{
  801582:	55                   	push   %ebp
  801583:	89 e5                	mov    %esp,%ebp
  801585:	56                   	push   %esi
  801586:	53                   	push   %ebx
  801587:	89 c6                	mov    %eax,%esi
  801589:	89 d3                	mov    %edx,%ebx
	static envid_t fsenv;
	if (fsenv == 0)
  80158b:	83 3d 00 40 80 00 00 	cmpl   $0x0,0x804000
  801592:	74 27                	je     8015bb <fsipc+0x39>
	static_assert(sizeof(fsipcbuf) == PGSIZE);

	if (debug)
		cprintf("[%08x] fsipc %d %08x\n", thisenv->env_id, type, *(uint32_t *)&fsipcbuf);

	ipc_send(fsenv, type, &fsipcbuf, PTE_P | PTE_W | PTE_U);
  801594:	6a 07                	push   $0x7
  801596:	68 00 50 80 00       	push   $0x805000
  80159b:	56                   	push   %esi
  80159c:	ff 35 00 40 80 00    	pushl  0x804000
  8015a2:	e8 40 09 00 00       	call   801ee7 <ipc_send>
	return ipc_recv(NULL, dstva, NULL);
  8015a7:	83 c4 0c             	add    $0xc,%esp
  8015aa:	6a 00                	push   $0x0
  8015ac:	53                   	push   %ebx
  8015ad:	6a 00                	push   $0x0
  8015af:	e8 b2 08 00 00       	call   801e66 <ipc_recv>
}
  8015b4:	8d 65 f8             	lea    -0x8(%ebp),%esp
  8015b7:	5b                   	pop    %ebx
  8015b8:	5e                   	pop    %esi
  8015b9:	5d                   	pop    %ebp
  8015ba:	c3                   	ret    
		fsenv = ipc_find_env(ENV_TYPE_FS);
  8015bb:	83 ec 0c             	sub    $0xc,%esp
  8015be:	6a 01                	push   $0x1
  8015c0:	e8 7a 09 00 00       	call   801f3f <ipc_find_env>
  8015c5:	a3 00 40 80 00       	mov    %eax,0x804000
  8015ca:	83 c4 10             	add    $0x10,%esp
  8015cd:	eb c5                	jmp    801594 <fsipc+0x12>

008015cf <devfile_trunc>:
}

// Truncate or extend an open file to 'size' bytes
static int
devfile_trunc(struct Fd *fd, off_t newsize)
{
  8015cf:	f3 0f 1e fb          	endbr32 
  8015d3:	55                   	push   %ebp
  8015d4:	89 e5                	mov    %esp,%ebp
  8015d6:	83 ec 08             	sub    $0x8,%esp
	fsipcbuf.set_size.req_fileid = fd->fd_file.id;
  8015d9:	8b 45 08             	mov    0x8(%ebp),%eax
  8015dc:	8b 40 0c             	mov    0xc(%eax),%eax
  8015df:	a3 00 50 80 00       	mov    %eax,0x805000
	fsipcbuf.set_size.req_size = newsize;
  8015e4:	8b 45 0c             	mov    0xc(%ebp),%eax
  8015e7:	a3 04 50 80 00       	mov    %eax,0x805004
	return fsipc(FSREQ_SET_SIZE, NULL);
  8015ec:	ba 00 00 00 00       	mov    $0x0,%edx
  8015f1:	b8 02 00 00 00       	mov    $0x2,%eax
  8015f6:	e8 87 ff ff ff       	call   801582 <fsipc>
}
  8015fb:	c9                   	leave  
  8015fc:	c3                   	ret    

008015fd <devfile_flush>:
{
  8015fd:	f3 0f 1e fb          	endbr32 
  801601:	55                   	push   %ebp
  801602:	89 e5                	mov    %esp,%ebp
  801604:	83 ec 08             	sub    $0x8,%esp
	fsipcbuf.flush.req_fileid = fd->fd_file.id;
  801607:	8b 45 08             	mov    0x8(%ebp),%eax
  80160a:	8b 40 0c             	mov    0xc(%eax),%eax
  80160d:	a3 00 50 80 00       	mov    %eax,0x805000
	return fsipc(FSREQ_FLUSH, NULL);
  801612:	ba 00 00 00 00       	mov    $0x0,%edx
  801617:	b8 06 00 00 00       	mov    $0x6,%eax
  80161c:	e8 61 ff ff ff       	call   801582 <fsipc>
}
  801621:	c9                   	leave  
  801622:	c3                   	ret    

00801623 <devfile_stat>:
{
  801623:	f3 0f 1e fb          	endbr32 
  801627:	55                   	push   %ebp
  801628:	89 e5                	mov    %esp,%ebp
  80162a:	53                   	push   %ebx
  80162b:	83 ec 04             	sub    $0x4,%esp
  80162e:	8b 5d 0c             	mov    0xc(%ebp),%ebx
	fsipcbuf.stat.req_fileid = fd->fd_file.id;
  801631:	8b 45 08             	mov    0x8(%ebp),%eax
  801634:	8b 40 0c             	mov    0xc(%eax),%eax
  801637:	a3 00 50 80 00       	mov    %eax,0x805000
	if ((r = fsipc(FSREQ_STAT, NULL)) < 0)
  80163c:	ba 00 00 00 00       	mov    $0x0,%edx
  801641:	b8 05 00 00 00       	mov    $0x5,%eax
  801646:	e8 37 ff ff ff       	call   801582 <fsipc>
  80164b:	85 c0                	test   %eax,%eax
  80164d:	78 2c                	js     80167b <devfile_stat+0x58>
	strcpy(st->st_name, fsipcbuf.statRet.ret_name);
  80164f:	83 ec 08             	sub    $0x8,%esp
  801652:	68 00 50 80 00       	push   $0x805000
  801657:	53                   	push   %ebx
  801658:	e8 a4 f1 ff ff       	call   800801 <strcpy>
	st->st_size = fsipcbuf.statRet.ret_size;
  80165d:	a1 80 50 80 00       	mov    0x805080,%eax
  801662:	89 83 80 00 00 00    	mov    %eax,0x80(%ebx)
	st->st_isdir = fsipcbuf.statRet.ret_isdir;
  801668:	a1 84 50 80 00       	mov    0x805084,%eax
  80166d:	89 83 84 00 00 00    	mov    %eax,0x84(%ebx)
	return 0;
  801673:	83 c4 10             	add    $0x10,%esp
  801676:	b8 00 00 00 00       	mov    $0x0,%eax
}
  80167b:	8b 5d fc             	mov    -0x4(%ebp),%ebx
  80167e:	c9                   	leave  
  80167f:	c3                   	ret    

00801680 <devfile_write>:
{
  801680:	f3 0f 1e fb          	endbr32 
  801684:	55                   	push   %ebp
  801685:	89 e5                	mov    %esp,%ebp
  801687:	83 ec 0c             	sub    $0xc,%esp
  80168a:	8b 45 10             	mov    0x10(%ebp),%eax
  80168d:	3d f8 0f 00 00       	cmp    $0xff8,%eax
  801692:	ba f8 0f 00 00       	mov    $0xff8,%edx
  801697:	0f 47 c2             	cmova  %edx,%eax
	fsipcbuf.write.req_fileid = fd->fd_file.id;
  80169a:	8b 55 08             	mov    0x8(%ebp),%edx
  80169d:	8b 52 0c             	mov    0xc(%edx),%edx
  8016a0:	89 15 00 50 80 00    	mov    %edx,0x805000
	fsipcbuf.write.req_n = n;
  8016a6:	a3 04 50 80 00       	mov    %eax,0x805004
	memmove(fsipcbuf.write.req_buf, buf, n);
  8016ab:	50                   	push   %eax
  8016ac:	ff 75 0c             	pushl  0xc(%ebp)
  8016af:	68 08 50 80 00       	push   $0x805008
  8016b4:	e8 fe f2 ff ff       	call   8009b7 <memmove>
	return fsipc(FSREQ_WRITE, NULL);}
  8016b9:	ba 00 00 00 00       	mov    $0x0,%edx
  8016be:	b8 04 00 00 00       	mov    $0x4,%eax
  8016c3:	e8 ba fe ff ff       	call   801582 <fsipc>
  8016c8:	c9                   	leave  
  8016c9:	c3                   	ret    

008016ca <devfile_read>:
{
  8016ca:	f3 0f 1e fb          	endbr32 
  8016ce:	55                   	push   %ebp
  8016cf:	89 e5                	mov    %esp,%ebp
  8016d1:	56                   	push   %esi
  8016d2:	53                   	push   %ebx
  8016d3:	8b 75 10             	mov    0x10(%ebp),%esi
	fsipcbuf.read.req_fileid = fd->fd_file.id;
  8016d6:	8b 45 08             	mov    0x8(%ebp),%eax
  8016d9:	8b 40 0c             	mov    0xc(%eax),%eax
  8016dc:	a3 00 50 80 00       	mov    %eax,0x805000
	fsipcbuf.read.req_n = n;
  8016e1:	89 35 04 50 80 00    	mov    %esi,0x805004
	if ((r = fsipc(FSREQ_READ, NULL)) < 0)
  8016e7:	ba 00 00 00 00       	mov    $0x0,%edx
  8016ec:	b8 03 00 00 00       	mov    $0x3,%eax
  8016f1:	e8 8c fe ff ff       	call   801582 <fsipc>
  8016f6:	89 c3                	mov    %eax,%ebx
  8016f8:	85 c0                	test   %eax,%eax
  8016fa:	78 1f                	js     80171b <devfile_read+0x51>
	assert(r <= n);
  8016fc:	39 f0                	cmp    %esi,%eax
  8016fe:	77 24                	ja     801724 <devfile_read+0x5a>
	assert(r <= PGSIZE);
  801700:	3d 00 10 00 00       	cmp    $0x1000,%eax
  801705:	7f 33                	jg     80173a <devfile_read+0x70>
	memmove(buf, fsipcbuf.readRet.ret_buf, r);
  801707:	83 ec 04             	sub    $0x4,%esp
  80170a:	50                   	push   %eax
  80170b:	68 00 50 80 00       	push   $0x805000
  801710:	ff 75 0c             	pushl  0xc(%ebp)
  801713:	e8 9f f2 ff ff       	call   8009b7 <memmove>
	return r;
  801718:	83 c4 10             	add    $0x10,%esp
}
  80171b:	89 d8                	mov    %ebx,%eax
  80171d:	8d 65 f8             	lea    -0x8(%ebp),%esp
  801720:	5b                   	pop    %ebx
  801721:	5e                   	pop    %esi
  801722:	5d                   	pop    %ebp
  801723:	c3                   	ret    
	assert(r <= n);
  801724:	68 18 26 80 00       	push   $0x802618
  801729:	68 1f 26 80 00       	push   $0x80261f
  80172e:	6a 7c                	push   $0x7c
  801730:	68 34 26 80 00       	push   $0x802634
  801735:	e8 e2 06 00 00       	call   801e1c <_panic>
	assert(r <= PGSIZE);
  80173a:	68 3f 26 80 00       	push   $0x80263f
  80173f:	68 1f 26 80 00       	push   $0x80261f
  801744:	6a 7d                	push   $0x7d
  801746:	68 34 26 80 00       	push   $0x802634
  80174b:	e8 cc 06 00 00       	call   801e1c <_panic>

00801750 <open>:
{
  801750:	f3 0f 1e fb          	endbr32 
  801754:	55                   	push   %ebp
  801755:	89 e5                	mov    %esp,%ebp
  801757:	56                   	push   %esi
  801758:	53                   	push   %ebx
  801759:	83 ec 1c             	sub    $0x1c,%esp
  80175c:	8b 75 08             	mov    0x8(%ebp),%esi
	if (strlen(path) >= MAXPATHLEN)
  80175f:	56                   	push   %esi
  801760:	e8 59 f0 ff ff       	call   8007be <strlen>
  801765:	83 c4 10             	add    $0x10,%esp
  801768:	3d ff 03 00 00       	cmp    $0x3ff,%eax
  80176d:	7f 6c                	jg     8017db <open+0x8b>
	if ((r = fd_alloc(&fd)) < 0)
  80176f:	83 ec 0c             	sub    $0xc,%esp
  801772:	8d 45 f4             	lea    -0xc(%ebp),%eax
  801775:	50                   	push   %eax
  801776:	e8 67 f8 ff ff       	call   800fe2 <fd_alloc>
  80177b:	89 c3                	mov    %eax,%ebx
  80177d:	83 c4 10             	add    $0x10,%esp
  801780:	85 c0                	test   %eax,%eax
  801782:	78 3c                	js     8017c0 <open+0x70>
	strcpy(fsipcbuf.open.req_path, path);
  801784:	83 ec 08             	sub    $0x8,%esp
  801787:	56                   	push   %esi
  801788:	68 00 50 80 00       	push   $0x805000
  80178d:	e8 6f f0 ff ff       	call   800801 <strcpy>
	fsipcbuf.open.req_omode = mode;
  801792:	8b 45 0c             	mov    0xc(%ebp),%eax
  801795:	a3 00 54 80 00       	mov    %eax,0x805400
	if ((r = fsipc(FSREQ_OPEN, fd)) < 0) {
  80179a:	8b 55 f4             	mov    -0xc(%ebp),%edx
  80179d:	b8 01 00 00 00       	mov    $0x1,%eax
  8017a2:	e8 db fd ff ff       	call   801582 <fsipc>
  8017a7:	89 c3                	mov    %eax,%ebx
  8017a9:	83 c4 10             	add    $0x10,%esp
  8017ac:	85 c0                	test   %eax,%eax
  8017ae:	78 19                	js     8017c9 <open+0x79>
	return fd2num(fd);
  8017b0:	83 ec 0c             	sub    $0xc,%esp
  8017b3:	ff 75 f4             	pushl  -0xc(%ebp)
  8017b6:	e8 f8 f7 ff ff       	call   800fb3 <fd2num>
  8017bb:	89 c3                	mov    %eax,%ebx
  8017bd:	83 c4 10             	add    $0x10,%esp
}
  8017c0:	89 d8                	mov    %ebx,%eax
  8017c2:	8d 65 f8             	lea    -0x8(%ebp),%esp
  8017c5:	5b                   	pop    %ebx
  8017c6:	5e                   	pop    %esi
  8017c7:	5d                   	pop    %ebp
  8017c8:	c3                   	ret    
		fd_close(fd, 0);
  8017c9:	83 ec 08             	sub    $0x8,%esp
  8017cc:	6a 00                	push   $0x0
  8017ce:	ff 75 f4             	pushl  -0xc(%ebp)
  8017d1:	e8 10 f9 ff ff       	call   8010e6 <fd_close>
		return r;
  8017d6:	83 c4 10             	add    $0x10,%esp
  8017d9:	eb e5                	jmp    8017c0 <open+0x70>
		return -E_BAD_PATH;
  8017db:	bb f4 ff ff ff       	mov    $0xfffffff4,%ebx
  8017e0:	eb de                	jmp    8017c0 <open+0x70>

008017e2 <sync>:


// Synchronize disk with buffer cache
int
sync(void)
{
  8017e2:	f3 0f 1e fb          	endbr32 
  8017e6:	55                   	push   %ebp
  8017e7:	89 e5                	mov    %esp,%ebp
  8017e9:	83 ec 08             	sub    $0x8,%esp
	// Ask the file server to update the disk
	// by writing any dirty blocks in the buffer cache.

	return fsipc(FSREQ_SYNC, NULL);
  8017ec:	ba 00 00 00 00       	mov    $0x0,%edx
  8017f1:	b8 08 00 00 00       	mov    $0x8,%eax
  8017f6:	e8 87 fd ff ff       	call   801582 <fsipc>
}
  8017fb:	c9                   	leave  
  8017fc:	c3                   	ret    

008017fd <writebuf>:


static void
writebuf(struct printbuf *b)
{
	if (b->error > 0) {
  8017fd:	83 78 0c 00          	cmpl   $0x0,0xc(%eax)
  801801:	7f 01                	jg     801804 <writebuf+0x7>
  801803:	c3                   	ret    
{
  801804:	55                   	push   %ebp
  801805:	89 e5                	mov    %esp,%ebp
  801807:	53                   	push   %ebx
  801808:	83 ec 08             	sub    $0x8,%esp
  80180b:	89 c3                	mov    %eax,%ebx
		ssize_t result = write(b->fd, b->buf, b->idx);
  80180d:	ff 70 04             	pushl  0x4(%eax)
  801810:	8d 40 10             	lea    0x10(%eax),%eax
  801813:	50                   	push   %eax
  801814:	ff 33                	pushl  (%ebx)
  801816:	e8 76 fb ff ff       	call   801391 <write>
		if (result > 0)
  80181b:	83 c4 10             	add    $0x10,%esp
  80181e:	85 c0                	test   %eax,%eax
  801820:	7e 03                	jle    801825 <writebuf+0x28>
			b->result += result;
  801822:	01 43 08             	add    %eax,0x8(%ebx)
		if (result != b->idx) // error, or wrote less than supplied
  801825:	39 43 04             	cmp    %eax,0x4(%ebx)
  801828:	74 0d                	je     801837 <writebuf+0x3a>
			b->error = (result < 0 ? result : 0);
  80182a:	85 c0                	test   %eax,%eax
  80182c:	ba 00 00 00 00       	mov    $0x0,%edx
  801831:	0f 4f c2             	cmovg  %edx,%eax
  801834:	89 43 0c             	mov    %eax,0xc(%ebx)
	}
}
  801837:	8b 5d fc             	mov    -0x4(%ebp),%ebx
  80183a:	c9                   	leave  
  80183b:	c3                   	ret    

0080183c <putch>:

static void
putch(int ch, void *thunk)
{
  80183c:	f3 0f 1e fb          	endbr32 
  801840:	55                   	push   %ebp
  801841:	89 e5                	mov    %esp,%ebp
  801843:	53                   	push   %ebx
  801844:	83 ec 04             	sub    $0x4,%esp
  801847:	8b 5d 0c             	mov    0xc(%ebp),%ebx
	struct printbuf *b = (struct printbuf *) thunk;
	b->buf[b->idx++] = ch;
  80184a:	8b 53 04             	mov    0x4(%ebx),%edx
  80184d:	8d 42 01             	lea    0x1(%edx),%eax
  801850:	89 43 04             	mov    %eax,0x4(%ebx)
  801853:	8b 4d 08             	mov    0x8(%ebp),%ecx
  801856:	88 4c 13 10          	mov    %cl,0x10(%ebx,%edx,1)
	if (b->idx == 256) {
  80185a:	3d 00 01 00 00       	cmp    $0x100,%eax
  80185f:	74 06                	je     801867 <putch+0x2b>
		writebuf(b);
		b->idx = 0;
	}
}
  801861:	83 c4 04             	add    $0x4,%esp
  801864:	5b                   	pop    %ebx
  801865:	5d                   	pop    %ebp
  801866:	c3                   	ret    
		writebuf(b);
  801867:	89 d8                	mov    %ebx,%eax
  801869:	e8 8f ff ff ff       	call   8017fd <writebuf>
		b->idx = 0;
  80186e:	c7 43 04 00 00 00 00 	movl   $0x0,0x4(%ebx)
}
  801875:	eb ea                	jmp    801861 <putch+0x25>

00801877 <vfprintf>:

int
vfprintf(int fd, const char *fmt, va_list ap)
{
  801877:	f3 0f 1e fb          	endbr32 
  80187b:	55                   	push   %ebp
  80187c:	89 e5                	mov    %esp,%ebp
  80187e:	81 ec 18 01 00 00    	sub    $0x118,%esp
	struct printbuf b;

	b.fd = fd;
  801884:	8b 45 08             	mov    0x8(%ebp),%eax
  801887:	89 85 e8 fe ff ff    	mov    %eax,-0x118(%ebp)
	b.idx = 0;
  80188d:	c7 85 ec fe ff ff 00 	movl   $0x0,-0x114(%ebp)
  801894:	00 00 00 
	b.result = 0;
  801897:	c7 85 f0 fe ff ff 00 	movl   $0x0,-0x110(%ebp)
  80189e:	00 00 00 
	b.error = 1;
  8018a1:	c7 85 f4 fe ff ff 01 	movl   $0x1,-0x10c(%ebp)
  8018a8:	00 00 00 
	vprintfmt(putch, &b, fmt, ap);
  8018ab:	ff 75 10             	pushl  0x10(%ebp)
  8018ae:	ff 75 0c             	pushl  0xc(%ebp)
  8018b1:	8d 85 e8 fe ff ff    	lea    -0x118(%ebp),%eax
  8018b7:	50                   	push   %eax
  8018b8:	68 3c 18 80 00       	push   $0x80183c
  8018bd:	e8 69 ea ff ff       	call   80032b <vprintfmt>
	if (b.idx > 0)
  8018c2:	83 c4 10             	add    $0x10,%esp
  8018c5:	83 bd ec fe ff ff 00 	cmpl   $0x0,-0x114(%ebp)
  8018cc:	7f 11                	jg     8018df <vfprintf+0x68>
		writebuf(&b);

	return (b.result ? b.result : b.error);
  8018ce:	8b 85 f0 fe ff ff    	mov    -0x110(%ebp),%eax
  8018d4:	85 c0                	test   %eax,%eax
  8018d6:	0f 44 85 f4 fe ff ff 	cmove  -0x10c(%ebp),%eax
}
  8018dd:	c9                   	leave  
  8018de:	c3                   	ret    
		writebuf(&b);
  8018df:	8d 85 e8 fe ff ff    	lea    -0x118(%ebp),%eax
  8018e5:	e8 13 ff ff ff       	call   8017fd <writebuf>
  8018ea:	eb e2                	jmp    8018ce <vfprintf+0x57>

008018ec <fprintf>:

int
fprintf(int fd, const char *fmt, ...)
{
  8018ec:	f3 0f 1e fb          	endbr32 
  8018f0:	55                   	push   %ebp
  8018f1:	89 e5                	mov    %esp,%ebp
  8018f3:	83 ec 0c             	sub    $0xc,%esp
	va_list ap;
	int cnt;

	va_start(ap, fmt);
  8018f6:	8d 45 10             	lea    0x10(%ebp),%eax
	cnt = vfprintf(fd, fmt, ap);
  8018f9:	50                   	push   %eax
  8018fa:	ff 75 0c             	pushl  0xc(%ebp)
  8018fd:	ff 75 08             	pushl  0x8(%ebp)
  801900:	e8 72 ff ff ff       	call   801877 <vfprintf>
	va_end(ap);

	return cnt;
}
  801905:	c9                   	leave  
  801906:	c3                   	ret    

00801907 <printf>:

int
printf(const char *fmt, ...)
{
  801907:	f3 0f 1e fb          	endbr32 
  80190b:	55                   	push   %ebp
  80190c:	89 e5                	mov    %esp,%ebp
  80190e:	83 ec 0c             	sub    $0xc,%esp
	va_list ap;
	int cnt;

	va_start(ap, fmt);
  801911:	8d 45 0c             	lea    0xc(%ebp),%eax
	cnt = vfprintf(1, fmt, ap);
  801914:	50                   	push   %eax
  801915:	ff 75 08             	pushl  0x8(%ebp)
  801918:	6a 01                	push   $0x1
  80191a:	e8 58 ff ff ff       	call   801877 <vfprintf>
	va_end(ap);

	return cnt;
}
  80191f:	c9                   	leave  
  801920:	c3                   	ret    

00801921 <devpipe_stat>:
	return i;
}

static int
devpipe_stat(struct Fd *fd, struct Stat *stat)
{
  801921:	f3 0f 1e fb          	endbr32 
  801925:	55                   	push   %ebp
  801926:	89 e5                	mov    %esp,%ebp
  801928:	56                   	push   %esi
  801929:	53                   	push   %ebx
  80192a:	8b 5d 0c             	mov    0xc(%ebp),%ebx
	struct Pipe *p = (struct Pipe*) fd2data(fd);
  80192d:	83 ec 0c             	sub    $0xc,%esp
  801930:	ff 75 08             	pushl  0x8(%ebp)
  801933:	e8 8f f6 ff ff       	call   800fc7 <fd2data>
  801938:	89 c6                	mov    %eax,%esi
	strcpy(stat->st_name, "<pipe>");
  80193a:	83 c4 08             	add    $0x8,%esp
  80193d:	68 4b 26 80 00       	push   $0x80264b
  801942:	53                   	push   %ebx
  801943:	e8 b9 ee ff ff       	call   800801 <strcpy>
	stat->st_size = p->p_wpos - p->p_rpos;
  801948:	8b 46 04             	mov    0x4(%esi),%eax
  80194b:	2b 06                	sub    (%esi),%eax
  80194d:	89 83 80 00 00 00    	mov    %eax,0x80(%ebx)
	stat->st_isdir = 0;
  801953:	c7 83 84 00 00 00 00 	movl   $0x0,0x84(%ebx)
  80195a:	00 00 00 
	stat->st_dev = &devpipe;
  80195d:	c7 83 88 00 00 00 20 	movl   $0x803020,0x88(%ebx)
  801964:	30 80 00 
	return 0;
}
  801967:	b8 00 00 00 00       	mov    $0x0,%eax
  80196c:	8d 65 f8             	lea    -0x8(%ebp),%esp
  80196f:	5b                   	pop    %ebx
  801970:	5e                   	pop    %esi
  801971:	5d                   	pop    %ebp
  801972:	c3                   	ret    

00801973 <devpipe_close>:

static int
devpipe_close(struct Fd *fd)
{
  801973:	f3 0f 1e fb          	endbr32 
  801977:	55                   	push   %ebp
  801978:	89 e5                	mov    %esp,%ebp
  80197a:	53                   	push   %ebx
  80197b:	83 ec 0c             	sub    $0xc,%esp
  80197e:	8b 5d 08             	mov    0x8(%ebp),%ebx
	(void) sys_page_unmap(0, fd);
  801981:	53                   	push   %ebx
  801982:	6a 00                	push   $0x0
  801984:	e8 47 f3 ff ff       	call   800cd0 <sys_page_unmap>
	return sys_page_unmap(0, fd2data(fd));
  801989:	89 1c 24             	mov    %ebx,(%esp)
  80198c:	e8 36 f6 ff ff       	call   800fc7 <fd2data>
  801991:	83 c4 08             	add    $0x8,%esp
  801994:	50                   	push   %eax
  801995:	6a 00                	push   $0x0
  801997:	e8 34 f3 ff ff       	call   800cd0 <sys_page_unmap>
}
  80199c:	8b 5d fc             	mov    -0x4(%ebp),%ebx
  80199f:	c9                   	leave  
  8019a0:	c3                   	ret    

008019a1 <_pipeisclosed>:
{
  8019a1:	55                   	push   %ebp
  8019a2:	89 e5                	mov    %esp,%ebp
  8019a4:	57                   	push   %edi
  8019a5:	56                   	push   %esi
  8019a6:	53                   	push   %ebx
  8019a7:	83 ec 1c             	sub    $0x1c,%esp
  8019aa:	89 c7                	mov    %eax,%edi
  8019ac:	89 d6                	mov    %edx,%esi
		n = thisenv->env_runs;
  8019ae:	a1 04 40 80 00       	mov    0x804004,%eax
  8019b3:	8b 58 58             	mov    0x58(%eax),%ebx
		ret = pageref(fd) == pageref(p);
  8019b6:	83 ec 0c             	sub    $0xc,%esp
  8019b9:	57                   	push   %edi
  8019ba:	e8 bd 05 00 00       	call   801f7c <pageref>
  8019bf:	89 45 e4             	mov    %eax,-0x1c(%ebp)
  8019c2:	89 34 24             	mov    %esi,(%esp)
  8019c5:	e8 b2 05 00 00       	call   801f7c <pageref>
		nn = thisenv->env_runs;
  8019ca:	8b 15 04 40 80 00    	mov    0x804004,%edx
  8019d0:	8b 4a 58             	mov    0x58(%edx),%ecx
		if (n == nn)
  8019d3:	83 c4 10             	add    $0x10,%esp
  8019d6:	39 cb                	cmp    %ecx,%ebx
  8019d8:	74 1b                	je     8019f5 <_pipeisclosed+0x54>
		if (n != nn && ret == 1)
  8019da:	39 45 e4             	cmp    %eax,-0x1c(%ebp)
  8019dd:	75 cf                	jne    8019ae <_pipeisclosed+0xd>
			cprintf("pipe race avoided\n", n, thisenv->env_runs, ret);
  8019df:	8b 42 58             	mov    0x58(%edx),%eax
  8019e2:	6a 01                	push   $0x1
  8019e4:	50                   	push   %eax
  8019e5:	53                   	push   %ebx
  8019e6:	68 52 26 80 00       	push   $0x802652
  8019eb:	e8 38 e8 ff ff       	call   800228 <cprintf>
  8019f0:	83 c4 10             	add    $0x10,%esp
  8019f3:	eb b9                	jmp    8019ae <_pipeisclosed+0xd>
		ret = pageref(fd) == pageref(p);
  8019f5:	39 45 e4             	cmp    %eax,-0x1c(%ebp)
  8019f8:	0f 94 c0             	sete   %al
  8019fb:	0f b6 c0             	movzbl %al,%eax
}
  8019fe:	8d 65 f4             	lea    -0xc(%ebp),%esp
  801a01:	5b                   	pop    %ebx
  801a02:	5e                   	pop    %esi
  801a03:	5f                   	pop    %edi
  801a04:	5d                   	pop    %ebp
  801a05:	c3                   	ret    

00801a06 <devpipe_write>:
{
  801a06:	f3 0f 1e fb          	endbr32 
  801a0a:	55                   	push   %ebp
  801a0b:	89 e5                	mov    %esp,%ebp
  801a0d:	57                   	push   %edi
  801a0e:	56                   	push   %esi
  801a0f:	53                   	push   %ebx
  801a10:	83 ec 28             	sub    $0x28,%esp
  801a13:	8b 75 08             	mov    0x8(%ebp),%esi
	p = (struct Pipe*) fd2data(fd);
  801a16:	56                   	push   %esi
  801a17:	e8 ab f5 ff ff       	call   800fc7 <fd2data>
  801a1c:	89 c3                	mov    %eax,%ebx
	for (i = 0; i < n; i++) {
  801a1e:	83 c4 10             	add    $0x10,%esp
  801a21:	bf 00 00 00 00       	mov    $0x0,%edi
  801a26:	3b 7d 10             	cmp    0x10(%ebp),%edi
  801a29:	74 4f                	je     801a7a <devpipe_write+0x74>
		while (p->p_wpos >= p->p_rpos + sizeof(p->p_buf)) {
  801a2b:	8b 43 04             	mov    0x4(%ebx),%eax
  801a2e:	8b 0b                	mov    (%ebx),%ecx
  801a30:	8d 51 20             	lea    0x20(%ecx),%edx
  801a33:	39 d0                	cmp    %edx,%eax
  801a35:	72 14                	jb     801a4b <devpipe_write+0x45>
			if (_pipeisclosed(fd, p))
  801a37:	89 da                	mov    %ebx,%edx
  801a39:	89 f0                	mov    %esi,%eax
  801a3b:	e8 61 ff ff ff       	call   8019a1 <_pipeisclosed>
  801a40:	85 c0                	test   %eax,%eax
  801a42:	75 3b                	jne    801a7f <devpipe_write+0x79>
			sys_yield();
  801a44:	e8 d7 f1 ff ff       	call   800c20 <sys_yield>
  801a49:	eb e0                	jmp    801a2b <devpipe_write+0x25>
		p->p_buf[p->p_wpos % PIPEBUFSIZ] = buf[i];
  801a4b:	8b 4d 0c             	mov    0xc(%ebp),%ecx
  801a4e:	0f b6 0c 39          	movzbl (%ecx,%edi,1),%ecx
  801a52:	88 4d e7             	mov    %cl,-0x19(%ebp)
  801a55:	89 c2                	mov    %eax,%edx
  801a57:	c1 fa 1f             	sar    $0x1f,%edx
  801a5a:	89 d1                	mov    %edx,%ecx
  801a5c:	c1 e9 1b             	shr    $0x1b,%ecx
  801a5f:	8d 14 08             	lea    (%eax,%ecx,1),%edx
  801a62:	83 e2 1f             	and    $0x1f,%edx
  801a65:	29 ca                	sub    %ecx,%edx
  801a67:	0f b6 4d e7          	movzbl -0x19(%ebp),%ecx
  801a6b:	88 4c 13 08          	mov    %cl,0x8(%ebx,%edx,1)
		p->p_wpos++;
  801a6f:	83 c0 01             	add    $0x1,%eax
  801a72:	89 43 04             	mov    %eax,0x4(%ebx)
	for (i = 0; i < n; i++) {
  801a75:	83 c7 01             	add    $0x1,%edi
  801a78:	eb ac                	jmp    801a26 <devpipe_write+0x20>
	return i;
  801a7a:	8b 45 10             	mov    0x10(%ebp),%eax
  801a7d:	eb 05                	jmp    801a84 <devpipe_write+0x7e>
				return 0;
  801a7f:	b8 00 00 00 00       	mov    $0x0,%eax
}
  801a84:	8d 65 f4             	lea    -0xc(%ebp),%esp
  801a87:	5b                   	pop    %ebx
  801a88:	5e                   	pop    %esi
  801a89:	5f                   	pop    %edi
  801a8a:	5d                   	pop    %ebp
  801a8b:	c3                   	ret    

00801a8c <devpipe_read>:
{
  801a8c:	f3 0f 1e fb          	endbr32 
  801a90:	55                   	push   %ebp
  801a91:	89 e5                	mov    %esp,%ebp
  801a93:	57                   	push   %edi
  801a94:	56                   	push   %esi
  801a95:	53                   	push   %ebx
  801a96:	83 ec 18             	sub    $0x18,%esp
  801a99:	8b 7d 08             	mov    0x8(%ebp),%edi
	p = (struct Pipe*)fd2data(fd);
  801a9c:	57                   	push   %edi
  801a9d:	e8 25 f5 ff ff       	call   800fc7 <fd2data>
  801aa2:	89 c3                	mov    %eax,%ebx
	for (i = 0; i < n; i++) {
  801aa4:	83 c4 10             	add    $0x10,%esp
  801aa7:	be 00 00 00 00       	mov    $0x0,%esi
  801aac:	3b 75 10             	cmp    0x10(%ebp),%esi
  801aaf:	75 14                	jne    801ac5 <devpipe_read+0x39>
	return i;
  801ab1:	8b 45 10             	mov    0x10(%ebp),%eax
  801ab4:	eb 02                	jmp    801ab8 <devpipe_read+0x2c>
				return i;
  801ab6:	89 f0                	mov    %esi,%eax
}
  801ab8:	8d 65 f4             	lea    -0xc(%ebp),%esp
  801abb:	5b                   	pop    %ebx
  801abc:	5e                   	pop    %esi
  801abd:	5f                   	pop    %edi
  801abe:	5d                   	pop    %ebp
  801abf:	c3                   	ret    
			sys_yield();
  801ac0:	e8 5b f1 ff ff       	call   800c20 <sys_yield>
		while (p->p_rpos == p->p_wpos) {
  801ac5:	8b 03                	mov    (%ebx),%eax
  801ac7:	3b 43 04             	cmp    0x4(%ebx),%eax
  801aca:	75 18                	jne    801ae4 <devpipe_read+0x58>
			if (i > 0)
  801acc:	85 f6                	test   %esi,%esi
  801ace:	75 e6                	jne    801ab6 <devpipe_read+0x2a>
			if (_pipeisclosed(fd, p))
  801ad0:	89 da                	mov    %ebx,%edx
  801ad2:	89 f8                	mov    %edi,%eax
  801ad4:	e8 c8 fe ff ff       	call   8019a1 <_pipeisclosed>
  801ad9:	85 c0                	test   %eax,%eax
  801adb:	74 e3                	je     801ac0 <devpipe_read+0x34>
				return 0;
  801add:	b8 00 00 00 00       	mov    $0x0,%eax
  801ae2:	eb d4                	jmp    801ab8 <devpipe_read+0x2c>
		buf[i] = p->p_buf[p->p_rpos % PIPEBUFSIZ];
  801ae4:	99                   	cltd   
  801ae5:	c1 ea 1b             	shr    $0x1b,%edx
  801ae8:	01 d0                	add    %edx,%eax
  801aea:	83 e0 1f             	and    $0x1f,%eax
  801aed:	29 d0                	sub    %edx,%eax
  801aef:	0f b6 44 03 08       	movzbl 0x8(%ebx,%eax,1),%eax
  801af4:	8b 4d 0c             	mov    0xc(%ebp),%ecx
  801af7:	88 04 31             	mov    %al,(%ecx,%esi,1)
		p->p_rpos++;
  801afa:	83 03 01             	addl   $0x1,(%ebx)
	for (i = 0; i < n; i++) {
  801afd:	83 c6 01             	add    $0x1,%esi
  801b00:	eb aa                	jmp    801aac <devpipe_read+0x20>

00801b02 <pipe>:
{
  801b02:	f3 0f 1e fb          	endbr32 
  801b06:	55                   	push   %ebp
  801b07:	89 e5                	mov    %esp,%ebp
  801b09:	56                   	push   %esi
  801b0a:	53                   	push   %ebx
  801b0b:	83 ec 1c             	sub    $0x1c,%esp
	if ((r = fd_alloc(&fd0)) < 0
  801b0e:	8d 45 f4             	lea    -0xc(%ebp),%eax
  801b11:	50                   	push   %eax
  801b12:	e8 cb f4 ff ff       	call   800fe2 <fd_alloc>
  801b17:	89 c3                	mov    %eax,%ebx
  801b19:	83 c4 10             	add    $0x10,%esp
  801b1c:	85 c0                	test   %eax,%eax
  801b1e:	0f 88 23 01 00 00    	js     801c47 <pipe+0x145>
	    || (r = sys_page_alloc(0, fd0, PTE_P|PTE_W|PTE_U|PTE_SHARE)) < 0)
  801b24:	83 ec 04             	sub    $0x4,%esp
  801b27:	68 07 04 00 00       	push   $0x407
  801b2c:	ff 75 f4             	pushl  -0xc(%ebp)
  801b2f:	6a 00                	push   $0x0
  801b31:	e8 0d f1 ff ff       	call   800c43 <sys_page_alloc>
  801b36:	89 c3                	mov    %eax,%ebx
  801b38:	83 c4 10             	add    $0x10,%esp
  801b3b:	85 c0                	test   %eax,%eax
  801b3d:	0f 88 04 01 00 00    	js     801c47 <pipe+0x145>
	if ((r = fd_alloc(&fd1)) < 0
  801b43:	83 ec 0c             	sub    $0xc,%esp
  801b46:	8d 45 f0             	lea    -0x10(%ebp),%eax
  801b49:	50                   	push   %eax
  801b4a:	e8 93 f4 ff ff       	call   800fe2 <fd_alloc>
  801b4f:	89 c3                	mov    %eax,%ebx
  801b51:	83 c4 10             	add    $0x10,%esp
  801b54:	85 c0                	test   %eax,%eax
  801b56:	0f 88 db 00 00 00    	js     801c37 <pipe+0x135>
	    || (r = sys_page_alloc(0, fd1, PTE_P|PTE_W|PTE_U|PTE_SHARE)) < 0)
  801b5c:	83 ec 04             	sub    $0x4,%esp
  801b5f:	68 07 04 00 00       	push   $0x407
  801b64:	ff 75 f0             	pushl  -0x10(%ebp)
  801b67:	6a 00                	push   $0x0
  801b69:	e8 d5 f0 ff ff       	call   800c43 <sys_page_alloc>
  801b6e:	89 c3                	mov    %eax,%ebx
  801b70:	83 c4 10             	add    $0x10,%esp
  801b73:	85 c0                	test   %eax,%eax
  801b75:	0f 88 bc 00 00 00    	js     801c37 <pipe+0x135>
	va = fd2data(fd0);
  801b7b:	83 ec 0c             	sub    $0xc,%esp
  801b7e:	ff 75 f4             	pushl  -0xc(%ebp)
  801b81:	e8 41 f4 ff ff       	call   800fc7 <fd2data>
  801b86:	89 c6                	mov    %eax,%esi
	if ((r = sys_page_alloc(0, va, PTE_P|PTE_W|PTE_U|PTE_SHARE)) < 0)
  801b88:	83 c4 0c             	add    $0xc,%esp
  801b8b:	68 07 04 00 00       	push   $0x407
  801b90:	50                   	push   %eax
  801b91:	6a 00                	push   $0x0
  801b93:	e8 ab f0 ff ff       	call   800c43 <sys_page_alloc>
  801b98:	89 c3                	mov    %eax,%ebx
  801b9a:	83 c4 10             	add    $0x10,%esp
  801b9d:	85 c0                	test   %eax,%eax
  801b9f:	0f 88 82 00 00 00    	js     801c27 <pipe+0x125>
	if ((r = sys_page_map(0, va, 0, fd2data(fd1), PTE_P|PTE_W|PTE_U|PTE_SHARE)) < 0)
  801ba5:	83 ec 0c             	sub    $0xc,%esp
  801ba8:	ff 75 f0             	pushl  -0x10(%ebp)
  801bab:	e8 17 f4 ff ff       	call   800fc7 <fd2data>
  801bb0:	c7 04 24 07 04 00 00 	movl   $0x407,(%esp)
  801bb7:	50                   	push   %eax
  801bb8:	6a 00                	push   $0x0
  801bba:	56                   	push   %esi
  801bbb:	6a 00                	push   $0x0
  801bbd:	e8 c8 f0 ff ff       	call   800c8a <sys_page_map>
  801bc2:	89 c3                	mov    %eax,%ebx
  801bc4:	83 c4 20             	add    $0x20,%esp
  801bc7:	85 c0                	test   %eax,%eax
  801bc9:	78 4e                	js     801c19 <pipe+0x117>
	fd0->fd_dev_id = devpipe.dev_id;
  801bcb:	a1 20 30 80 00       	mov    0x803020,%eax
  801bd0:	8b 55 f4             	mov    -0xc(%ebp),%edx
  801bd3:	89 02                	mov    %eax,(%edx)
	fd0->fd_omode = O_RDONLY;
  801bd5:	8b 55 f4             	mov    -0xc(%ebp),%edx
  801bd8:	c7 42 08 00 00 00 00 	movl   $0x0,0x8(%edx)
	fd1->fd_dev_id = devpipe.dev_id;
  801bdf:	8b 55 f0             	mov    -0x10(%ebp),%edx
  801be2:	89 02                	mov    %eax,(%edx)
	fd1->fd_omode = O_WRONLY;
  801be4:	8b 45 f0             	mov    -0x10(%ebp),%eax
  801be7:	c7 40 08 01 00 00 00 	movl   $0x1,0x8(%eax)
	pfd[0] = fd2num(fd0);
  801bee:	83 ec 0c             	sub    $0xc,%esp
  801bf1:	ff 75 f4             	pushl  -0xc(%ebp)
  801bf4:	e8 ba f3 ff ff       	call   800fb3 <fd2num>
  801bf9:	8b 4d 08             	mov    0x8(%ebp),%ecx
  801bfc:	89 01                	mov    %eax,(%ecx)
	pfd[1] = fd2num(fd1);
  801bfe:	83 c4 04             	add    $0x4,%esp
  801c01:	ff 75 f0             	pushl  -0x10(%ebp)
  801c04:	e8 aa f3 ff ff       	call   800fb3 <fd2num>
  801c09:	8b 4d 08             	mov    0x8(%ebp),%ecx
  801c0c:	89 41 04             	mov    %eax,0x4(%ecx)
	return 0;
  801c0f:	83 c4 10             	add    $0x10,%esp
  801c12:	bb 00 00 00 00       	mov    $0x0,%ebx
  801c17:	eb 2e                	jmp    801c47 <pipe+0x145>
	sys_page_unmap(0, va);
  801c19:	83 ec 08             	sub    $0x8,%esp
  801c1c:	56                   	push   %esi
  801c1d:	6a 00                	push   $0x0
  801c1f:	e8 ac f0 ff ff       	call   800cd0 <sys_page_unmap>
  801c24:	83 c4 10             	add    $0x10,%esp
	sys_page_unmap(0, fd1);
  801c27:	83 ec 08             	sub    $0x8,%esp
  801c2a:	ff 75 f0             	pushl  -0x10(%ebp)
  801c2d:	6a 00                	push   $0x0
  801c2f:	e8 9c f0 ff ff       	call   800cd0 <sys_page_unmap>
  801c34:	83 c4 10             	add    $0x10,%esp
	sys_page_unmap(0, fd0);
  801c37:	83 ec 08             	sub    $0x8,%esp
  801c3a:	ff 75 f4             	pushl  -0xc(%ebp)
  801c3d:	6a 00                	push   $0x0
  801c3f:	e8 8c f0 ff ff       	call   800cd0 <sys_page_unmap>
  801c44:	83 c4 10             	add    $0x10,%esp
}
  801c47:	89 d8                	mov    %ebx,%eax
  801c49:	8d 65 f8             	lea    -0x8(%ebp),%esp
  801c4c:	5b                   	pop    %ebx
  801c4d:	5e                   	pop    %esi
  801c4e:	5d                   	pop    %ebp
  801c4f:	c3                   	ret    

00801c50 <pipeisclosed>:
{
  801c50:	f3 0f 1e fb          	endbr32 
  801c54:	55                   	push   %ebp
  801c55:	89 e5                	mov    %esp,%ebp
  801c57:	83 ec 20             	sub    $0x20,%esp
	if ((r = fd_lookup(fdnum, &fd)) < 0)
  801c5a:	8d 45 f4             	lea    -0xc(%ebp),%eax
  801c5d:	50                   	push   %eax
  801c5e:	ff 75 08             	pushl  0x8(%ebp)
  801c61:	e8 d2 f3 ff ff       	call   801038 <fd_lookup>
  801c66:	83 c4 10             	add    $0x10,%esp
  801c69:	85 c0                	test   %eax,%eax
  801c6b:	78 18                	js     801c85 <pipeisclosed+0x35>
	p = (struct Pipe*) fd2data(fd);
  801c6d:	83 ec 0c             	sub    $0xc,%esp
  801c70:	ff 75 f4             	pushl  -0xc(%ebp)
  801c73:	e8 4f f3 ff ff       	call   800fc7 <fd2data>
  801c78:	89 c2                	mov    %eax,%edx
	return _pipeisclosed(fd, p);
  801c7a:	8b 45 f4             	mov    -0xc(%ebp),%eax
  801c7d:	e8 1f fd ff ff       	call   8019a1 <_pipeisclosed>
  801c82:	83 c4 10             	add    $0x10,%esp
}
  801c85:	c9                   	leave  
  801c86:	c3                   	ret    

00801c87 <devcons_close>:
	return tot;
}

static int
devcons_close(struct Fd *fd)
{
  801c87:	f3 0f 1e fb          	endbr32 
	USED(fd);

	return 0;
}
  801c8b:	b8 00 00 00 00       	mov    $0x0,%eax
  801c90:	c3                   	ret    

00801c91 <devcons_stat>:

static int
devcons_stat(struct Fd *fd, struct Stat *stat)
{
  801c91:	f3 0f 1e fb          	endbr32 
  801c95:	55                   	push   %ebp
  801c96:	89 e5                	mov    %esp,%ebp
  801c98:	83 ec 10             	sub    $0x10,%esp
	strcpy(stat->st_name, "<cons>");
  801c9b:	68 6a 26 80 00       	push   $0x80266a
  801ca0:	ff 75 0c             	pushl  0xc(%ebp)
  801ca3:	e8 59 eb ff ff       	call   800801 <strcpy>
	return 0;
}
  801ca8:	b8 00 00 00 00       	mov    $0x0,%eax
  801cad:	c9                   	leave  
  801cae:	c3                   	ret    

00801caf <devcons_write>:
{
  801caf:	f3 0f 1e fb          	endbr32 
  801cb3:	55                   	push   %ebp
  801cb4:	89 e5                	mov    %esp,%ebp
  801cb6:	57                   	push   %edi
  801cb7:	56                   	push   %esi
  801cb8:	53                   	push   %ebx
  801cb9:	81 ec 8c 00 00 00    	sub    $0x8c,%esp
	for (tot = 0; tot < n; tot += m) {
  801cbf:	be 00 00 00 00       	mov    $0x0,%esi
		memmove(buf, (char*)vbuf + tot, m);
  801cc4:	8d bd 68 ff ff ff    	lea    -0x98(%ebp),%edi
	for (tot = 0; tot < n; tot += m) {
  801cca:	3b 75 10             	cmp    0x10(%ebp),%esi
  801ccd:	73 31                	jae    801d00 <devcons_write+0x51>
		m = n - tot;
  801ccf:	8b 5d 10             	mov    0x10(%ebp),%ebx
  801cd2:	29 f3                	sub    %esi,%ebx
  801cd4:	83 fb 7f             	cmp    $0x7f,%ebx
  801cd7:	b8 7f 00 00 00       	mov    $0x7f,%eax
  801cdc:	0f 47 d8             	cmova  %eax,%ebx
		memmove(buf, (char*)vbuf + tot, m);
  801cdf:	83 ec 04             	sub    $0x4,%esp
  801ce2:	53                   	push   %ebx
  801ce3:	89 f0                	mov    %esi,%eax
  801ce5:	03 45 0c             	add    0xc(%ebp),%eax
  801ce8:	50                   	push   %eax
  801ce9:	57                   	push   %edi
  801cea:	e8 c8 ec ff ff       	call   8009b7 <memmove>
		sys_cputs(buf, m);
  801cef:	83 c4 08             	add    $0x8,%esp
  801cf2:	53                   	push   %ebx
  801cf3:	57                   	push   %edi
  801cf4:	e8 7a ee ff ff       	call   800b73 <sys_cputs>
	for (tot = 0; tot < n; tot += m) {
  801cf9:	01 de                	add    %ebx,%esi
  801cfb:	83 c4 10             	add    $0x10,%esp
  801cfe:	eb ca                	jmp    801cca <devcons_write+0x1b>
}
  801d00:	89 f0                	mov    %esi,%eax
  801d02:	8d 65 f4             	lea    -0xc(%ebp),%esp
  801d05:	5b                   	pop    %ebx
  801d06:	5e                   	pop    %esi
  801d07:	5f                   	pop    %edi
  801d08:	5d                   	pop    %ebp
  801d09:	c3                   	ret    

00801d0a <devcons_read>:
{
  801d0a:	f3 0f 1e fb          	endbr32 
  801d0e:	55                   	push   %ebp
  801d0f:	89 e5                	mov    %esp,%ebp
  801d11:	83 ec 08             	sub    $0x8,%esp
  801d14:	b8 00 00 00 00       	mov    $0x0,%eax
	if (n == 0)
  801d19:	83 7d 10 00          	cmpl   $0x0,0x10(%ebp)
  801d1d:	74 21                	je     801d40 <devcons_read+0x36>
	while ((c = sys_cgetc()) == 0)
  801d1f:	e8 71 ee ff ff       	call   800b95 <sys_cgetc>
  801d24:	85 c0                	test   %eax,%eax
  801d26:	75 07                	jne    801d2f <devcons_read+0x25>
		sys_yield();
  801d28:	e8 f3 ee ff ff       	call   800c20 <sys_yield>
  801d2d:	eb f0                	jmp    801d1f <devcons_read+0x15>
	if (c < 0)
  801d2f:	78 0f                	js     801d40 <devcons_read+0x36>
	if (c == 0x04)	// ctl-d is eof
  801d31:	83 f8 04             	cmp    $0x4,%eax
  801d34:	74 0c                	je     801d42 <devcons_read+0x38>
	*(char*)vbuf = c;
  801d36:	8b 55 0c             	mov    0xc(%ebp),%edx
  801d39:	88 02                	mov    %al,(%edx)
	return 1;
  801d3b:	b8 01 00 00 00       	mov    $0x1,%eax
}
  801d40:	c9                   	leave  
  801d41:	c3                   	ret    
		return 0;
  801d42:	b8 00 00 00 00       	mov    $0x0,%eax
  801d47:	eb f7                	jmp    801d40 <devcons_read+0x36>

00801d49 <cputchar>:
{
  801d49:	f3 0f 1e fb          	endbr32 
  801d4d:	55                   	push   %ebp
  801d4e:	89 e5                	mov    %esp,%ebp
  801d50:	83 ec 20             	sub    $0x20,%esp
	char c = ch;
  801d53:	8b 45 08             	mov    0x8(%ebp),%eax
  801d56:	88 45 f7             	mov    %al,-0x9(%ebp)
	sys_cputs(&c, 1);
  801d59:	6a 01                	push   $0x1
  801d5b:	8d 45 f7             	lea    -0x9(%ebp),%eax
  801d5e:	50                   	push   %eax
  801d5f:	e8 0f ee ff ff       	call   800b73 <sys_cputs>
}
  801d64:	83 c4 10             	add    $0x10,%esp
  801d67:	c9                   	leave  
  801d68:	c3                   	ret    

00801d69 <getchar>:
{
  801d69:	f3 0f 1e fb          	endbr32 
  801d6d:	55                   	push   %ebp
  801d6e:	89 e5                	mov    %esp,%ebp
  801d70:	83 ec 1c             	sub    $0x1c,%esp
	r = read(0, &c, 1);
  801d73:	6a 01                	push   $0x1
  801d75:	8d 45 f7             	lea    -0x9(%ebp),%eax
  801d78:	50                   	push   %eax
  801d79:	6a 00                	push   $0x0
  801d7b:	e8 3b f5 ff ff       	call   8012bb <read>
	if (r < 0)
  801d80:	83 c4 10             	add    $0x10,%esp
  801d83:	85 c0                	test   %eax,%eax
  801d85:	78 06                	js     801d8d <getchar+0x24>
	if (r < 1)
  801d87:	74 06                	je     801d8f <getchar+0x26>
	return c;
  801d89:	0f b6 45 f7          	movzbl -0x9(%ebp),%eax
}
  801d8d:	c9                   	leave  
  801d8e:	c3                   	ret    
		return -E_EOF;
  801d8f:	b8 f8 ff ff ff       	mov    $0xfffffff8,%eax
  801d94:	eb f7                	jmp    801d8d <getchar+0x24>

00801d96 <iscons>:
{
  801d96:	f3 0f 1e fb          	endbr32 
  801d9a:	55                   	push   %ebp
  801d9b:	89 e5                	mov    %esp,%ebp
  801d9d:	83 ec 20             	sub    $0x20,%esp
	if ((r = fd_lookup(fdnum, &fd)) < 0)
  801da0:	8d 45 f4             	lea    -0xc(%ebp),%eax
  801da3:	50                   	push   %eax
  801da4:	ff 75 08             	pushl  0x8(%ebp)
  801da7:	e8 8c f2 ff ff       	call   801038 <fd_lookup>
  801dac:	83 c4 10             	add    $0x10,%esp
  801daf:	85 c0                	test   %eax,%eax
  801db1:	78 11                	js     801dc4 <iscons+0x2e>
	return fd->fd_dev_id == devcons.dev_id;
  801db3:	8b 45 f4             	mov    -0xc(%ebp),%eax
  801db6:	8b 15 3c 30 80 00    	mov    0x80303c,%edx
  801dbc:	39 10                	cmp    %edx,(%eax)
  801dbe:	0f 94 c0             	sete   %al
  801dc1:	0f b6 c0             	movzbl %al,%eax
}
  801dc4:	c9                   	leave  
  801dc5:	c3                   	ret    

00801dc6 <opencons>:
{
  801dc6:	f3 0f 1e fb          	endbr32 
  801dca:	55                   	push   %ebp
  801dcb:	89 e5                	mov    %esp,%ebp
  801dcd:	83 ec 24             	sub    $0x24,%esp
	if ((r = fd_alloc(&fd)) < 0)
  801dd0:	8d 45 f4             	lea    -0xc(%ebp),%eax
  801dd3:	50                   	push   %eax
  801dd4:	e8 09 f2 ff ff       	call   800fe2 <fd_alloc>
  801dd9:	83 c4 10             	add    $0x10,%esp
  801ddc:	85 c0                	test   %eax,%eax
  801dde:	78 3a                	js     801e1a <opencons+0x54>
	if ((r = sys_page_alloc(0, fd, PTE_P|PTE_U|PTE_W|PTE_SHARE)) < 0)
  801de0:	83 ec 04             	sub    $0x4,%esp
  801de3:	68 07 04 00 00       	push   $0x407
  801de8:	ff 75 f4             	pushl  -0xc(%ebp)
  801deb:	6a 00                	push   $0x0
  801ded:	e8 51 ee ff ff       	call   800c43 <sys_page_alloc>
  801df2:	83 c4 10             	add    $0x10,%esp
  801df5:	85 c0                	test   %eax,%eax
  801df7:	78 21                	js     801e1a <opencons+0x54>
	fd->fd_dev_id = devcons.dev_id;
  801df9:	8b 45 f4             	mov    -0xc(%ebp),%eax
  801dfc:	8b 15 3c 30 80 00    	mov    0x80303c,%edx
  801e02:	89 10                	mov    %edx,(%eax)
	fd->fd_omode = O_RDWR;
  801e04:	8b 45 f4             	mov    -0xc(%ebp),%eax
  801e07:	c7 40 08 02 00 00 00 	movl   $0x2,0x8(%eax)
	return fd2num(fd);
  801e0e:	83 ec 0c             	sub    $0xc,%esp
  801e11:	50                   	push   %eax
  801e12:	e8 9c f1 ff ff       	call   800fb3 <fd2num>
  801e17:	83 c4 10             	add    $0x10,%esp
}
  801e1a:	c9                   	leave  
  801e1b:	c3                   	ret    

00801e1c <_panic>:
 * It prints "panic: <message>", then causes a breakpoint exception,
 * which causes JOS to enter the JOS kernel monitor.
 */
void
_panic(const char *file, int line, const char *fmt, ...)
{
  801e1c:	f3 0f 1e fb          	endbr32 
  801e20:	55                   	push   %ebp
  801e21:	89 e5                	mov    %esp,%ebp
  801e23:	56                   	push   %esi
  801e24:	53                   	push   %ebx
	va_list ap;

	va_start(ap, fmt);
  801e25:	8d 5d 14             	lea    0x14(%ebp),%ebx

	// Print the panic message
	cprintf("[%08x] user panic in %s at %s:%d: ",
  801e28:	8b 35 00 30 80 00    	mov    0x803000,%esi
  801e2e:	e8 ca ed ff ff       	call   800bfd <sys_getenvid>
  801e33:	83 ec 0c             	sub    $0xc,%esp
  801e36:	ff 75 0c             	pushl  0xc(%ebp)
  801e39:	ff 75 08             	pushl  0x8(%ebp)
  801e3c:	56                   	push   %esi
  801e3d:	50                   	push   %eax
  801e3e:	68 78 26 80 00       	push   $0x802678
  801e43:	e8 e0 e3 ff ff       	call   800228 <cprintf>
		sys_getenvid(), binaryname, file, line);
	vcprintf(fmt, ap);
  801e48:	83 c4 18             	add    $0x18,%esp
  801e4b:	53                   	push   %ebx
  801e4c:	ff 75 10             	pushl  0x10(%ebp)
  801e4f:	e8 7f e3 ff ff       	call   8001d3 <vcprintf>
	cprintf("\n");
  801e54:	c7 04 24 30 22 80 00 	movl   $0x802230,(%esp)
  801e5b:	e8 c8 e3 ff ff       	call   800228 <cprintf>
  801e60:	83 c4 10             	add    $0x10,%esp

	// Cause a breakpoint exception
	while (1)
		asm volatile("int3");
  801e63:	cc                   	int3   
  801e64:	eb fd                	jmp    801e63 <_panic+0x47>

00801e66 <ipc_recv>:
//   If 'pg' is null, pass sys_ipc_recv a value that it will understand
//   as meaning "no page".  (Zero is not the right value, since that's
//   a perfectly valid place to map a page.)
int32_t
ipc_recv(envid_t *from_env_store, void *pg, int *perm_store)
{
  801e66:	f3 0f 1e fb          	endbr32 
  801e6a:	55                   	push   %ebp
  801e6b:	89 e5                	mov    %esp,%ebp
  801e6d:	56                   	push   %esi
  801e6e:	53                   	push   %ebx
  801e6f:	8b 75 08             	mov    0x8(%ebp),%esi
  801e72:	8b 45 0c             	mov    0xc(%ebp),%eax
  801e75:	8b 5d 10             	mov    0x10(%ebp),%ebx
	// LAB 4: Your code here.
	int error;
	if(!pg)pg = (void *)UTOP; // 如果设置为UTOP，这个值其实可以比UTOP大，设置为这个值认为pg无效了，不会进行页面传递【共享页面的设置】，而是只进行值value的传递。
  801e78:	85 c0                	test   %eax,%eax
  801e7a:	ba 00 00 c0 ee       	mov    $0xeec00000,%edx
  801e7f:	0f 44 c2             	cmove  %edx,%eax
	if((error = sys_ipc_recv(pg)) < 0){
  801e82:	83 ec 0c             	sub    $0xc,%esp
  801e85:	50                   	push   %eax
  801e86:	e8 84 ef ff ff       	call   800e0f <sys_ipc_recv>
  801e8b:	83 c4 10             	add    $0x10,%esp
  801e8e:	85 c0                	test   %eax,%eax
  801e90:	78 3f                	js     801ed1 <ipc_recv+0x6b>
		if(from_env_store)*from_env_store = 0;
		if(perm_store)*perm_store = 0;
		return error;
	}

	thisenv = &envs[ENVX(sys_getenvid())]; // for lab4's challenge sfork().
  801e92:	e8 66 ed ff ff       	call   800bfd <sys_getenvid>
  801e97:	25 ff 03 00 00       	and    $0x3ff,%eax
  801e9c:	6b d0 7c             	imul   $0x7c,%eax,%edx
  801e9f:	81 c2 00 00 c0 ee    	add    $0xeec00000,%edx
  801ea5:	89 15 04 40 80 00    	mov    %edx,0x804004

	if(from_env_store)*from_env_store = thisenv->env_ipc_from;
  801eab:	85 f6                	test   %esi,%esi
  801ead:	74 05                	je     801eb4 <ipc_recv+0x4e>
  801eaf:	8b 42 74             	mov    0x74(%edx),%eax
  801eb2:	89 06                	mov    %eax,(%esi)
	if(perm_store)*perm_store = thisenv->env_ipc_perm;
  801eb4:	85 db                	test   %ebx,%ebx
  801eb6:	74 0a                	je     801ec2 <ipc_recv+0x5c>
  801eb8:	a1 04 40 80 00       	mov    0x804004,%eax
  801ebd:	8b 40 78             	mov    0x78(%eax),%eax
  801ec0:	89 03                	mov    %eax,(%ebx)
	return thisenv->env_ipc_value;
  801ec2:	a1 04 40 80 00       	mov    0x804004,%eax
  801ec7:	8b 40 70             	mov    0x70(%eax),%eax
}
  801eca:	8d 65 f8             	lea    -0x8(%ebp),%esp
  801ecd:	5b                   	pop    %ebx
  801ece:	5e                   	pop    %esi
  801ecf:	5d                   	pop    %ebp
  801ed0:	c3                   	ret    
		if(from_env_store)*from_env_store = 0;
  801ed1:	85 f6                	test   %esi,%esi
  801ed3:	74 06                	je     801edb <ipc_recv+0x75>
  801ed5:	c7 06 00 00 00 00    	movl   $0x0,(%esi)
		if(perm_store)*perm_store = 0;
  801edb:	85 db                	test   %ebx,%ebx
  801edd:	74 eb                	je     801eca <ipc_recv+0x64>
  801edf:	c7 03 00 00 00 00    	movl   $0x0,(%ebx)
  801ee5:	eb e3                	jmp    801eca <ipc_recv+0x64>

00801ee7 <ipc_send>:
//   Use sys_yield() to be CPU-friendly.
//   If 'pg' is null, pass sys_ipc_try_send a value that it will understand
//   as meaning "no page".  (Zero is not the right value.)
void
ipc_send(envid_t to_env, uint32_t val, void *pg, int perm)
{
  801ee7:	f3 0f 1e fb          	endbr32 
  801eeb:	55                   	push   %ebp
  801eec:	89 e5                	mov    %esp,%ebp
  801eee:	57                   	push   %edi
  801eef:	56                   	push   %esi
  801ef0:	53                   	push   %ebx
  801ef1:	83 ec 0c             	sub    $0xc,%esp
  801ef4:	8b 7d 08             	mov    0x8(%ebp),%edi
  801ef7:	8b 75 0c             	mov    0xc(%ebp),%esi
  801efa:	8b 5d 10             	mov    0x10(%ebp),%ebx
	// LAB 4: Your code here.
	if(!pg)pg = (void *)UTOP; // 不会进行页面共享，只会sending message。
  801efd:	85 db                	test   %ebx,%ebx
  801eff:	b8 00 00 c0 ee       	mov    $0xeec00000,%eax
  801f04:	0f 44 d8             	cmove  %eax,%ebx
	int error;
	// Keep trying until it succeeds.
	while((error = sys_ipc_try_send(to_env, val, pg, perm)) < 0){
  801f07:	ff 75 14             	pushl  0x14(%ebp)
  801f0a:	53                   	push   %ebx
  801f0b:	56                   	push   %esi
  801f0c:	57                   	push   %edi
  801f0d:	e8 d6 ee ff ff       	call   800de8 <sys_ipc_try_send>
  801f12:	83 c4 10             	add    $0x10,%esp
  801f15:	85 c0                	test   %eax,%eax
  801f17:	79 1e                	jns    801f37 <ipc_send+0x50>
        //如果error是没有接收者，那么就会继续尝试send
		if(error != -E_IPC_NOT_RECV){
  801f19:	83 f8 f9             	cmp    $0xfffffff9,%eax
  801f1c:	75 07                	jne    801f25 <ipc_send+0x3e>
			panic("sys_ipc_try_send:%e", error);
		}
        //但是不是一味的占用cpu，而是尝试一次就释放CPU，等待再次被调度，才会重新send，寻找receiver。
		sys_yield(); // To be CPU-friendly.
  801f1e:	e8 fd ec ff ff       	call   800c20 <sys_yield>
  801f23:	eb e2                	jmp    801f07 <ipc_send+0x20>
			panic("sys_ipc_try_send:%e", error);
  801f25:	50                   	push   %eax
  801f26:	68 9b 26 80 00       	push   $0x80269b
  801f2b:	6a 3b                	push   $0x3b
  801f2d:	68 af 26 80 00       	push   $0x8026af
  801f32:	e8 e5 fe ff ff       	call   801e1c <_panic>
	}
}
  801f37:	8d 65 f4             	lea    -0xc(%ebp),%esp
  801f3a:	5b                   	pop    %ebx
  801f3b:	5e                   	pop    %esi
  801f3c:	5f                   	pop    %edi
  801f3d:	5d                   	pop    %ebp
  801f3e:	c3                   	ret    

00801f3f <ipc_find_env>:
// Find the first environment of the given type.  We'll use this to
// find special environments.
// Returns 0 if no such environment exists.
envid_t
ipc_find_env(enum EnvType type)
{
  801f3f:	f3 0f 1e fb          	endbr32 
  801f43:	55                   	push   %ebp
  801f44:	89 e5                	mov    %esp,%ebp
  801f46:	8b 4d 08             	mov    0x8(%ebp),%ecx
	int i;
	for (i = 0; i < NENV; i++)
  801f49:	b8 00 00 00 00       	mov    $0x0,%eax
		if (envs[i].env_type == type)
  801f4e:	6b d0 7c             	imul   $0x7c,%eax,%edx
  801f51:	81 c2 00 00 c0 ee    	add    $0xeec00000,%edx
  801f57:	8b 52 50             	mov    0x50(%edx),%edx
  801f5a:	39 ca                	cmp    %ecx,%edx
  801f5c:	74 11                	je     801f6f <ipc_find_env+0x30>
	for (i = 0; i < NENV; i++)
  801f5e:	83 c0 01             	add    $0x1,%eax
  801f61:	3d 00 04 00 00       	cmp    $0x400,%eax
  801f66:	75 e6                	jne    801f4e <ipc_find_env+0xf>
			return envs[i].env_id;
	return 0;
  801f68:	b8 00 00 00 00       	mov    $0x0,%eax
  801f6d:	eb 0b                	jmp    801f7a <ipc_find_env+0x3b>
			return envs[i].env_id;
  801f6f:	6b c0 7c             	imul   $0x7c,%eax,%eax
  801f72:	05 00 00 c0 ee       	add    $0xeec00000,%eax
  801f77:	8b 40 48             	mov    0x48(%eax),%eax
}
  801f7a:	5d                   	pop    %ebp
  801f7b:	c3                   	ret    

00801f7c <pageref>:
#include <inc/lib.h>

int
pageref(void *v)
{
  801f7c:	f3 0f 1e fb          	endbr32 
  801f80:	55                   	push   %ebp
  801f81:	89 e5                	mov    %esp,%ebp
  801f83:	8b 45 08             	mov    0x8(%ebp),%eax
	pte_t pte;

	if (!(uvpd[PDX(v)] & PTE_P))
  801f86:	89 c2                	mov    %eax,%edx
  801f88:	c1 ea 16             	shr    $0x16,%edx
  801f8b:	8b 0c 95 00 d0 7b ef 	mov    -0x10843000(,%edx,4),%ecx
		return 0;
  801f92:	ba 00 00 00 00       	mov    $0x0,%edx
	if (!(uvpd[PDX(v)] & PTE_P))
  801f97:	f6 c1 01             	test   $0x1,%cl
  801f9a:	74 1c                	je     801fb8 <pageref+0x3c>
	pte = uvpt[PGNUM(v)];
  801f9c:	c1 e8 0c             	shr    $0xc,%eax
  801f9f:	8b 04 85 00 00 40 ef 	mov    -0x10c00000(,%eax,4),%eax
	if (!(pte & PTE_P))
  801fa6:	a8 01                	test   $0x1,%al
  801fa8:	74 0e                	je     801fb8 <pageref+0x3c>
		return 0;
	return pages[PGNUM(pte)].pp_ref;
  801faa:	c1 e8 0c             	shr    $0xc,%eax
  801fad:	0f b7 14 c5 04 00 00 	movzwl -0x10fffffc(,%eax,8),%edx
  801fb4:	ef 
  801fb5:	0f b7 d2             	movzwl %dx,%edx
}
  801fb8:	89 d0                	mov    %edx,%eax
  801fba:	5d                   	pop    %ebp
  801fbb:	c3                   	ret    
  801fbc:	66 90                	xchg   %ax,%ax
  801fbe:	66 90                	xchg   %ax,%ax

00801fc0 <__udivdi3>:
  801fc0:	f3 0f 1e fb          	endbr32 
  801fc4:	55                   	push   %ebp
  801fc5:	57                   	push   %edi
  801fc6:	56                   	push   %esi
  801fc7:	53                   	push   %ebx
  801fc8:	83 ec 1c             	sub    $0x1c,%esp
  801fcb:	8b 54 24 3c          	mov    0x3c(%esp),%edx
  801fcf:	8b 6c 24 30          	mov    0x30(%esp),%ebp
  801fd3:	8b 74 24 34          	mov    0x34(%esp),%esi
  801fd7:	8b 5c 24 38          	mov    0x38(%esp),%ebx
  801fdb:	85 d2                	test   %edx,%edx
  801fdd:	75 19                	jne    801ff8 <__udivdi3+0x38>
  801fdf:	39 f3                	cmp    %esi,%ebx
  801fe1:	76 4d                	jbe    802030 <__udivdi3+0x70>
  801fe3:	31 ff                	xor    %edi,%edi
  801fe5:	89 e8                	mov    %ebp,%eax
  801fe7:	89 f2                	mov    %esi,%edx
  801fe9:	f7 f3                	div    %ebx
  801feb:	89 fa                	mov    %edi,%edx
  801fed:	83 c4 1c             	add    $0x1c,%esp
  801ff0:	5b                   	pop    %ebx
  801ff1:	5e                   	pop    %esi
  801ff2:	5f                   	pop    %edi
  801ff3:	5d                   	pop    %ebp
  801ff4:	c3                   	ret    
  801ff5:	8d 76 00             	lea    0x0(%esi),%esi
  801ff8:	39 f2                	cmp    %esi,%edx
  801ffa:	76 14                	jbe    802010 <__udivdi3+0x50>
  801ffc:	31 ff                	xor    %edi,%edi
  801ffe:	31 c0                	xor    %eax,%eax
  802000:	89 fa                	mov    %edi,%edx
  802002:	83 c4 1c             	add    $0x1c,%esp
  802005:	5b                   	pop    %ebx
  802006:	5e                   	pop    %esi
  802007:	5f                   	pop    %edi
  802008:	5d                   	pop    %ebp
  802009:	c3                   	ret    
  80200a:	8d b6 00 00 00 00    	lea    0x0(%esi),%esi
  802010:	0f bd fa             	bsr    %edx,%edi
  802013:	83 f7 1f             	xor    $0x1f,%edi
  802016:	75 48                	jne    802060 <__udivdi3+0xa0>
  802018:	39 f2                	cmp    %esi,%edx
  80201a:	72 06                	jb     802022 <__udivdi3+0x62>
  80201c:	31 c0                	xor    %eax,%eax
  80201e:	39 eb                	cmp    %ebp,%ebx
  802020:	77 de                	ja     802000 <__udivdi3+0x40>
  802022:	b8 01 00 00 00       	mov    $0x1,%eax
  802027:	eb d7                	jmp    802000 <__udivdi3+0x40>
  802029:	8d b4 26 00 00 00 00 	lea    0x0(%esi,%eiz,1),%esi
  802030:	89 d9                	mov    %ebx,%ecx
  802032:	85 db                	test   %ebx,%ebx
  802034:	75 0b                	jne    802041 <__udivdi3+0x81>
  802036:	b8 01 00 00 00       	mov    $0x1,%eax
  80203b:	31 d2                	xor    %edx,%edx
  80203d:	f7 f3                	div    %ebx
  80203f:	89 c1                	mov    %eax,%ecx
  802041:	31 d2                	xor    %edx,%edx
  802043:	89 f0                	mov    %esi,%eax
  802045:	f7 f1                	div    %ecx
  802047:	89 c6                	mov    %eax,%esi
  802049:	89 e8                	mov    %ebp,%eax
  80204b:	89 f7                	mov    %esi,%edi
  80204d:	f7 f1                	div    %ecx
  80204f:	89 fa                	mov    %edi,%edx
  802051:	83 c4 1c             	add    $0x1c,%esp
  802054:	5b                   	pop    %ebx
  802055:	5e                   	pop    %esi
  802056:	5f                   	pop    %edi
  802057:	5d                   	pop    %ebp
  802058:	c3                   	ret    
  802059:	8d b4 26 00 00 00 00 	lea    0x0(%esi,%eiz,1),%esi
  802060:	89 f9                	mov    %edi,%ecx
  802062:	b8 20 00 00 00       	mov    $0x20,%eax
  802067:	29 f8                	sub    %edi,%eax
  802069:	d3 e2                	shl    %cl,%edx
  80206b:	89 54 24 08          	mov    %edx,0x8(%esp)
  80206f:	89 c1                	mov    %eax,%ecx
  802071:	89 da                	mov    %ebx,%edx
  802073:	d3 ea                	shr    %cl,%edx
  802075:	8b 4c 24 08          	mov    0x8(%esp),%ecx
  802079:	09 d1                	or     %edx,%ecx
  80207b:	89 f2                	mov    %esi,%edx
  80207d:	89 4c 24 08          	mov    %ecx,0x8(%esp)
  802081:	89 f9                	mov    %edi,%ecx
  802083:	d3 e3                	shl    %cl,%ebx
  802085:	89 c1                	mov    %eax,%ecx
  802087:	d3 ea                	shr    %cl,%edx
  802089:	89 f9                	mov    %edi,%ecx
  80208b:	89 5c 24 0c          	mov    %ebx,0xc(%esp)
  80208f:	89 eb                	mov    %ebp,%ebx
  802091:	d3 e6                	shl    %cl,%esi
  802093:	89 c1                	mov    %eax,%ecx
  802095:	d3 eb                	shr    %cl,%ebx
  802097:	09 de                	or     %ebx,%esi
  802099:	89 f0                	mov    %esi,%eax
  80209b:	f7 74 24 08          	divl   0x8(%esp)
  80209f:	89 d6                	mov    %edx,%esi
  8020a1:	89 c3                	mov    %eax,%ebx
  8020a3:	f7 64 24 0c          	mull   0xc(%esp)
  8020a7:	39 d6                	cmp    %edx,%esi
  8020a9:	72 15                	jb     8020c0 <__udivdi3+0x100>
  8020ab:	89 f9                	mov    %edi,%ecx
  8020ad:	d3 e5                	shl    %cl,%ebp
  8020af:	39 c5                	cmp    %eax,%ebp
  8020b1:	73 04                	jae    8020b7 <__udivdi3+0xf7>
  8020b3:	39 d6                	cmp    %edx,%esi
  8020b5:	74 09                	je     8020c0 <__udivdi3+0x100>
  8020b7:	89 d8                	mov    %ebx,%eax
  8020b9:	31 ff                	xor    %edi,%edi
  8020bb:	e9 40 ff ff ff       	jmp    802000 <__udivdi3+0x40>
  8020c0:	8d 43 ff             	lea    -0x1(%ebx),%eax
  8020c3:	31 ff                	xor    %edi,%edi
  8020c5:	e9 36 ff ff ff       	jmp    802000 <__udivdi3+0x40>
  8020ca:	66 90                	xchg   %ax,%ax
  8020cc:	66 90                	xchg   %ax,%ax
  8020ce:	66 90                	xchg   %ax,%ax

008020d0 <__umoddi3>:
  8020d0:	f3 0f 1e fb          	endbr32 
  8020d4:	55                   	push   %ebp
  8020d5:	57                   	push   %edi
  8020d6:	56                   	push   %esi
  8020d7:	53                   	push   %ebx
  8020d8:	83 ec 1c             	sub    $0x1c,%esp
  8020db:	8b 44 24 3c          	mov    0x3c(%esp),%eax
  8020df:	8b 74 24 30          	mov    0x30(%esp),%esi
  8020e3:	8b 5c 24 34          	mov    0x34(%esp),%ebx
  8020e7:	8b 7c 24 38          	mov    0x38(%esp),%edi
  8020eb:	85 c0                	test   %eax,%eax
  8020ed:	75 19                	jne    802108 <__umoddi3+0x38>
  8020ef:	39 df                	cmp    %ebx,%edi
  8020f1:	76 5d                	jbe    802150 <__umoddi3+0x80>
  8020f3:	89 f0                	mov    %esi,%eax
  8020f5:	89 da                	mov    %ebx,%edx
  8020f7:	f7 f7                	div    %edi
  8020f9:	89 d0                	mov    %edx,%eax
  8020fb:	31 d2                	xor    %edx,%edx
  8020fd:	83 c4 1c             	add    $0x1c,%esp
  802100:	5b                   	pop    %ebx
  802101:	5e                   	pop    %esi
  802102:	5f                   	pop    %edi
  802103:	5d                   	pop    %ebp
  802104:	c3                   	ret    
  802105:	8d 76 00             	lea    0x0(%esi),%esi
  802108:	89 f2                	mov    %esi,%edx
  80210a:	39 d8                	cmp    %ebx,%eax
  80210c:	76 12                	jbe    802120 <__umoddi3+0x50>
  80210e:	89 f0                	mov    %esi,%eax
  802110:	89 da                	mov    %ebx,%edx
  802112:	83 c4 1c             	add    $0x1c,%esp
  802115:	5b                   	pop    %ebx
  802116:	5e                   	pop    %esi
  802117:	5f                   	pop    %edi
  802118:	5d                   	pop    %ebp
  802119:	c3                   	ret    
  80211a:	8d b6 00 00 00 00    	lea    0x0(%esi),%esi
  802120:	0f bd e8             	bsr    %eax,%ebp
  802123:	83 f5 1f             	xor    $0x1f,%ebp
  802126:	75 50                	jne    802178 <__umoddi3+0xa8>
  802128:	39 d8                	cmp    %ebx,%eax
  80212a:	0f 82 e0 00 00 00    	jb     802210 <__umoddi3+0x140>
  802130:	89 d9                	mov    %ebx,%ecx
  802132:	39 f7                	cmp    %esi,%edi
  802134:	0f 86 d6 00 00 00    	jbe    802210 <__umoddi3+0x140>
  80213a:	89 d0                	mov    %edx,%eax
  80213c:	89 ca                	mov    %ecx,%edx
  80213e:	83 c4 1c             	add    $0x1c,%esp
  802141:	5b                   	pop    %ebx
  802142:	5e                   	pop    %esi
  802143:	5f                   	pop    %edi
  802144:	5d                   	pop    %ebp
  802145:	c3                   	ret    
  802146:	8d b4 26 00 00 00 00 	lea    0x0(%esi,%eiz,1),%esi
  80214d:	8d 76 00             	lea    0x0(%esi),%esi
  802150:	89 fd                	mov    %edi,%ebp
  802152:	85 ff                	test   %edi,%edi
  802154:	75 0b                	jne    802161 <__umoddi3+0x91>
  802156:	b8 01 00 00 00       	mov    $0x1,%eax
  80215b:	31 d2                	xor    %edx,%edx
  80215d:	f7 f7                	div    %edi
  80215f:	89 c5                	mov    %eax,%ebp
  802161:	89 d8                	mov    %ebx,%eax
  802163:	31 d2                	xor    %edx,%edx
  802165:	f7 f5                	div    %ebp
  802167:	89 f0                	mov    %esi,%eax
  802169:	f7 f5                	div    %ebp
  80216b:	89 d0                	mov    %edx,%eax
  80216d:	31 d2                	xor    %edx,%edx
  80216f:	eb 8c                	jmp    8020fd <__umoddi3+0x2d>
  802171:	8d b4 26 00 00 00 00 	lea    0x0(%esi,%eiz,1),%esi
  802178:	89 e9                	mov    %ebp,%ecx
  80217a:	ba 20 00 00 00       	mov    $0x20,%edx
  80217f:	29 ea                	sub    %ebp,%edx
  802181:	d3 e0                	shl    %cl,%eax
  802183:	89 44 24 08          	mov    %eax,0x8(%esp)
  802187:	89 d1                	mov    %edx,%ecx
  802189:	89 f8                	mov    %edi,%eax
  80218b:	d3 e8                	shr    %cl,%eax
  80218d:	8b 4c 24 08          	mov    0x8(%esp),%ecx
  802191:	89 54 24 04          	mov    %edx,0x4(%esp)
  802195:	8b 54 24 04          	mov    0x4(%esp),%edx
  802199:	09 c1                	or     %eax,%ecx
  80219b:	89 d8                	mov    %ebx,%eax
  80219d:	89 4c 24 08          	mov    %ecx,0x8(%esp)
  8021a1:	89 e9                	mov    %ebp,%ecx
  8021a3:	d3 e7                	shl    %cl,%edi
  8021a5:	89 d1                	mov    %edx,%ecx
  8021a7:	d3 e8                	shr    %cl,%eax
  8021a9:	89 e9                	mov    %ebp,%ecx
  8021ab:	89 7c 24 0c          	mov    %edi,0xc(%esp)
  8021af:	d3 e3                	shl    %cl,%ebx
  8021b1:	89 c7                	mov    %eax,%edi
  8021b3:	89 d1                	mov    %edx,%ecx
  8021b5:	89 f0                	mov    %esi,%eax
  8021b7:	d3 e8                	shr    %cl,%eax
  8021b9:	89 e9                	mov    %ebp,%ecx
  8021bb:	89 fa                	mov    %edi,%edx
  8021bd:	d3 e6                	shl    %cl,%esi
  8021bf:	09 d8                	or     %ebx,%eax
  8021c1:	f7 74 24 08          	divl   0x8(%esp)
  8021c5:	89 d1                	mov    %edx,%ecx
  8021c7:	89 f3                	mov    %esi,%ebx
  8021c9:	f7 64 24 0c          	mull   0xc(%esp)
  8021cd:	89 c6                	mov    %eax,%esi
  8021cf:	89 d7                	mov    %edx,%edi
  8021d1:	39 d1                	cmp    %edx,%ecx
  8021d3:	72 06                	jb     8021db <__umoddi3+0x10b>
  8021d5:	75 10                	jne    8021e7 <__umoddi3+0x117>
  8021d7:	39 c3                	cmp    %eax,%ebx
  8021d9:	73 0c                	jae    8021e7 <__umoddi3+0x117>
  8021db:	2b 44 24 0c          	sub    0xc(%esp),%eax
  8021df:	1b 54 24 08          	sbb    0x8(%esp),%edx
  8021e3:	89 d7                	mov    %edx,%edi
  8021e5:	89 c6                	mov    %eax,%esi
  8021e7:	89 ca                	mov    %ecx,%edx
  8021e9:	0f b6 4c 24 04       	movzbl 0x4(%esp),%ecx
  8021ee:	29 f3                	sub    %esi,%ebx
  8021f0:	19 fa                	sbb    %edi,%edx
  8021f2:	89 d0                	mov    %edx,%eax
  8021f4:	d3 e0                	shl    %cl,%eax
  8021f6:	89 e9                	mov    %ebp,%ecx
  8021f8:	d3 eb                	shr    %cl,%ebx
  8021fa:	d3 ea                	shr    %cl,%edx
  8021fc:	09 d8                	or     %ebx,%eax
  8021fe:	83 c4 1c             	add    $0x1c,%esp
  802201:	5b                   	pop    %ebx
  802202:	5e                   	pop    %esi
  802203:	5f                   	pop    %edi
  802204:	5d                   	pop    %ebp
  802205:	c3                   	ret    
  802206:	8d b4 26 00 00 00 00 	lea    0x0(%esi,%eiz,1),%esi
  80220d:	8d 76 00             	lea    0x0(%esi),%esi
  802210:	29 fe                	sub    %edi,%esi
  802212:	19 c3                	sbb    %eax,%ebx
  802214:	89 f2                	mov    %esi,%edx
  802216:	89 d9                	mov    %ebx,%ecx
  802218:	e9 1d ff ff ff       	jmp    80213a <__umoddi3+0x6a>
